-
jmayhugh
Hi. I’m using a custom child theme based on GeneratePress. I have a custom header.php template where I’m trying to output the primary menu.
When I use the core WordPress “wp_nav_menu( array( ‘theme_location’ => ‘primary’…” in this template, the generated menu is not getting correctly themed with the baseline GeneratePress primary menu options.
So then, I tried using a block Element in GeneratePress with the default WordPress “Nav” block and the “after_header” hook. This one does appear correctly, however this menu doesn’t stay in sync with any changes made in the Menu screen. It’s like it just spits out the menu as links and then doesn’t ever update if menu changes are made.
I looked all through your documentation and I couldn’t find anything related to a PHP function which would generate a menu in a GP-friendly way, nor can I find a GP/GB block element that is for the main menu (just the default WordPress one).
How do I output the main menu in my template or via a hook, have it use all the GP styles for menus and mobile menu, but still stay in sync with the menu, as designated in the WP Menus screen?
-
Hi there,
It’s like it just spits out the menu as links and then doesn’t ever update if menu changes are made.
Yes, it’s the expected behaviour for WP’s navigation block.
Can you try using GP’s site header element with GB Pro’s site header block which includes a GB Pro navigation block?
-
jmayhugh
Hi. Thanks for the quick response….I was puzzled by your “site header block” reference, but then I dug through the settings and noticed that there was a checkbox along the lines of “display version 1 blocks only”. When I unchecked that, I can see both a GP header and a navigation block. Thank you!
-
Awsome! Sorry I didn’t know you were using v1 blocks.
Glad you’ve figured it out!
- You must be logged in to reply to this topic.