• Resolved Tsevdos

    (@tsevdos)


    Hello there,

    I’ve added a custom menu to my latest theme, and as you can see below I’m passing a callback function (to view the categories in case the user has older WP version or he didn’t add any custom menus yet).

    My question is, How can I add arguments to this callback function?!?! I need to remove the title, order them etc.

    wp_nav_menu( array(
    	'theme_location'  => 'main',
    	'container'       => 'nav',
    	'container_class' => 'main',
    	'fallback_cb'     => 'wp_list_categories',
    	)
    );

    thanks in advance,
    John

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Tsevdos

    (@tsevdos)

    Any ideas?!?!

    You need to define an actual callback, rather than calling a core WordPress function.

    e.g. in functions.php:

    function mytheme_wp_nav_menu_cb() {
         // callback code goes here
         // you can even output wp_list_categories() if you want
    };

    Then, in your wp_nav_menu() call:

    wp_nav_menu( array(
    	'theme_location'  => 'main',
    	'container'       => 'nav',
    	'container_class' => 'main',
    	'fallback_cb'     => 'mytheme_wp_nav_menu_cb',
    	)
    );

    Thread Starter Tsevdos

    (@tsevdos)

    Awesome it worked great Chip! Thanks you so much.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom menus and fallback function arguments…’ is closed to new replies.