WordPress.org

Ready to get started?Download WordPress

Forums

Adding a variable inside wp_nav_menu (2 posts)

  1. onei0120
    Member
    Posted 2 years ago #

    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>',
    				));
  2. bcworkz
    Member
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags