Not working in WP 4.0?
Hi After update to 4.0 my menu shows only all pages, not the custom menu as before. Any idea what to do with this? Thanks in advance.
4.0 has updated the class-wp-walker and added a $has_children property so it's not necessary to hack the display_element function anymore, so just delete that function and it should probably work.
Lovely, just not really clear - for me. It means i can use normal wp menu as documented in the codex?
I tried to remove only the display_element function from wp_bootstrap_navwalker.php, but it acts still the same. Only list of pages is listed.
Ok, solved. Walker is working, the problem was I had in my theme code like this:
wp_nav_menu( array(
'menu' => 'main_menu',
'depth' => 2,
'container' => false,
'menu_class' => 'nav',
'fallback_cb' => 'wp_page_menu',
//Process nav menu using our custom nav walker
'walker' => new wp_bootstrap_navwalker())
);
but it have to be like this:
wp_nav_menu( array( 'theme_location' => 'main_menu',
'depth' => 2,
'container' => false,
'menu_class' => 'nav',
'fallback_cb' => 'wp_page_menu',
'walker' => new wp_bootstrap_navwalker() ) );
thanks for your help.
I see. wp-bootstrap-navwalker does work with Wordpress 4.0 without problems, but it has redundant code. After removing display_element you should also update all $args->has_children with the now default $this->has_children without breaking your existing code.
As you probably know already, Wordpress and Bootstrap dropdown menus just don’t mix out of the box. That's why you are using wp-bootstrap-navwalker. Now with 4.0, implementing your own Walker_Nav_Menu just got cleaner to implement.
Very interesting. If you want to push a commit I will take a look at it tonight. On Oct 4, 2014 6:59 AM, "Jorge Bucaran" [email protected] wrote:
I see. wp-bootstrap-navwalker does work with Wordpress 4.0 without problems, but it has redundant code. After removing display_element you should also update all $args->has_children with the now default $this->has_children without breaking your existing code.
As you probably know already, Wordpress and Bootstrap dropdown menus just don’t mix out of the box. That's why you are using wp-bootstrap-navwalker. Now with 4.0, implementing your own Walker_Nav_Menu just got cleaner to implement.
— Reply to this email directly or view it on GitHub https://github.com/twittem/wp-bootstrap-navwalker/issues/140#issuecomment-57904899 .
Thanks. I created the pull request a few hours ago.