Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

redletter on "wp_nav_menu() fallback not receiving vars"

$
0
0

I developed a custom walker class to implement the Bootstrap 3.0 menu structure so menus can be edited using the WordPress menu editor.

https://github.com/twittem/wp-bootstrap-navwalker

Everything works great except for the $fallback_cb which is used by default when the theme is installed. I read in the codex that

$fallback_cb
(string) (optional) If the menu doesn't exist, the fallback function to use. Set to false for no fallback. Note: Passes $args to the custom function.

The issue seems to be that the wp_page_menu function is not receiving the $args from the wp_nav_menu() declaration.

Here is my current wp_nav_menu() declaration.

<?php
wp_nav_menu( array(
      'menu'           => 'primary',
      'theme_location' => 'primary',
      'depth'          => 2,
      'container'      => false,
      'menu_class'     => 'nav navbar-nav',
      'fallback_cb'    => 'wp_page_menu',
      'walker'         => new wp_bootstrap_navwalker())
);
?>

Can anyone offer some insight into how I might resolve this issue?


Viewing all articles
Browse latest Browse all 8245

Trending Articles