WordPress.org

Support

Support » Plugins and Hacks » Hacks » Adding a variable inside wp_nav_menu

Adding a variable inside wp_nav_menu

  • Hey Guys,

    I am trying to add a variable inside wp_nav_menu, I am not sure how to do it, please help me! Here is a snippet of the code

    wp_nav_menu(array(
    					'menu' => 'Main Menu',
    					'theme_location' => 'Main Menu',
    					'container' => null,
    					'container_class' => '',
    					'menu_id' => 'header-menu',
    					'menu_class' => '',
    					'before' => '<span class="text1">',
      					'after' => '</span><span class="text2"><a href="">' . the_title($post->ID) . '</a></span>',
    				));
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    @bcworkz

    You can add any ‘key’=> value you like to any array just as you have already done, but wp_nav_menu will not know what to do with it, so I’m not sure what the purpose would be.

Viewing 1 replies (of 1 total)
  • The topic ‘Adding a variable inside wp_nav_menu’ is closed to new replies.
Skip to toolbar