Skip Navigation

[Closed] Add custom menu to Toolset CPT template

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 6 replies, has 3 voices.

Last updated by Luo Yang 1 year, 10 months ago.

Assisted by: Luo Yang.

Author
Posts
#2598347

I need to add a custom menu to my CPT template-
or allow it to show when done via functions.php and the WP Widget controls.

Reading your site and googling. I activated an after-content widget in functions.php, which is showing in the admin, which could host the menu - but I can't get it to show.
The menu shortcode WP plugin mentioned in old help chats on your site is deprecated and out of the repository.

I tried creating a code snippet in Toolset Settings, but could not find a way to add it to the template.

Is there a similar example that we can see? no

When I installed the plugin after-content widget, it worked, but displayed the menu twice. Something weird going on with that plugin.
It should be fairly straightforward... just add a template part to host a custom menu.
How do you do it?

it should be showing on these pages as currently configured.
hidden link
hidden link

#2598643

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Sorry, Jon

I'm not entirely sure what it is you are asking to do.

Are you talking about the normal menus that you create in the WordPress dashboard at Appearance > Menus?

And you want to display this menu only when showing posts of some CPT you have created with Toolset?

And you want to display it somewhere in the content area, rather than to replace the site menu with this particular menu when showing these CPTs?

If we understand exactly what you are aiming for we can help direct you to a solution.

#2598653
Screenshot 2023-04-24 at 10.33.14 AM.png
Screenshot 2023-04-24 at 10.31.02 AM.png
Screenshot 2023-04-24 at 10.28.39 AM.png

Thanks for getting back, Nigel..
For every page of a particular custom post type ("storypages"), I need to integrate a custom navigation menu.
I'm almost there - this might be a WordPress issue with Navigation blocks...
I had tried adding a menu with a widget after-content, but can't get it to work.
I see WP5 has a Navigation block, so I'm trying to implement that now.
OK. I've added it to my Types template. The editor allows me to choose my custom menu, and will display a menu in pages of the CPT I'm working on, but it displays the main site nav , not the custom menu - when the custom menu is chosen in the template editor.
I just went back in to the template editor to take a screenshot for you, and got an error "Menu has been deleted or is unavailable".
After clicking "create new menu," I was able to restore it (second image) - so you can see it shows up on the back end.
But - (third image) - it renders the main nav menu instead of the custom menu showing in the template.
??

#2598685

Well, I did it old style with an html block. Problem solved... I still would like to know what the issue is there. It looks like it might be a WP 5.x bug

#2598713

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Screenshot 2023-04-24 at 16.20.37.png

I'm not sure what the issue is on your site.

I just tried it on my local test site without issue.

I created a menu (I didn't assign it to any location as I would be using it in my CPT template).

I edited the template for my CPT and inserted a navigation block; as I only had one registered menu I didn't have to select it, it was pre-selected.

No problems editing the template, or updating it, and then the menu displayed as expected when I visited one of the CPT posts on the front end.

I was going to suggest you might want to register a custom shortcode that uses wp_nav_menu to generate the menu, but it appears that wouldn't be necessary.

It looks like yours is an edge case dependent on the particulars of your set up.

#2598733

Try adding a second menu and see if that works for you...
The main nav is the one that loaded, despite my having chosen the second ("custom") menu to display in the template.
On the front end, the CPT page displays the main nav, not the one chosen in the template builder.

#2598949

Hello,

I have tried it in a fresh WP installation + the latest version of Toolset plugins, I can add two "Navigation" blocks + two menus without any problem, see below sandbox website:
Login URL: hidden link

Content template:
hidden link

Can you reproduce the same problem in above sandbox website?

The topic ‘[Closed] Add custom menu to Toolset CPT template’ is closed to new replies.