- This topic has 3 replies, 2 voices, and was last updated 3 months, 3 weeks ago by
David.
-
AuthorPosts
-
April 13, 2022 at 6:45 am #2187458
Sam
Hi!
I’m using GP for years and I still love it!I found out an issue in one of my sites that I let pass for a year. Shame on me!
I have two different headers in this site so I can use two different menus and logos: one for the shop and another for the main part of the site.
In the shop menu I created a menu with submenu items for “Benefícios” (Benefits). All items are wordpress product tags.
Some of the submenu items show the appropriate menu.
Examples:
https://www.sementesdamor.pt/tag/desintoxicacao/
https://www.sementesdamor.pt/tag/figado/Some of the menu items when clicked show the results with the main site menu. This is odd and shouldn’t happen.
Examples:
https://www.sementesdamor.pt/tag/sangue/
https://www.sementesdamor.pt/tag/articulacoes/How do I find out what makes this happen?
I send you a print screen of the header element I created.
April 13, 2022 at 7:26 am #2187502David
StaffCustomer SupportHi there,
how are you conditionally displaying the different menus ?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/April 14, 2022 at 2:12 am #2188403Sam
I’m sorry Dave,
I was checking the conditions in order to answer you… Then I remembered I used the plugin already mentioned here: conditional menus by Themify.So it’s not an issue from mighty GP.
But since I come up with this… Can you guys consider a way for us users to create conditional menus inside a hook? That would be awesome!
Because, as you can see, the expression “conditional menu” comes up in support forum questions in 12 pages!So, you can look at it as a kind of a feature request already!
Thanks agains Dave!
April 14, 2022 at 2:36 am #2188415David
StaffCustomer SupportSwapping the menus can be done using the
wp_nav_menu_args
filter.
For example:add_filter( 'wp_nav_menu_args', 'db_switch_menus' ); function db_switch_menus( $args ) { if( 'primary' === $args['theme_location'] && is_single() ) { $args['menu'] = '99'; } return $args; }
Where
primary
is the Navigation, and99
is the ID of the Menu you want displayed if theis_single()
condition is met ie. its a Single Post.Aside from the nice UI and the complex conditional logic rules that the plugins provide, they probably also deal with transients, caching and a host of other things that should be considered that are out of my pay grade lol
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.