Wednesday, 15 August 2012

php - How to use in Wordpress other menu for all pages under slash? -


I have WP4, as a home page. I need to use another menu for all the URLs under slash (e.g., / blog, / post, html, / page.html) theme's header. Current code in FPP:

  If_nav_menu ('primary')) {wp_nav_menu (array ('theme_location' = & gt; 'primary', 'container' = & gt; wrong, 'menu_class' = & gt; nav uppercase font-priority ',' Walker '= & gt; New Vntd_Custom_Menu_Class ())); } Else {echo '& lt; Span class = "vntd-no-nav" & gt; No custom menu created! & Lt; / Span & gt; '; }  

The 'primary' menu for the main page is OK, now I have to use menu id = 385 for all the other URLs.

You have to take out your homepage and use a separate menu for all other pages. You can do this:

  if_home () is_front_page) {if_nav_menu ('primary')) {wp_nav_menu (array ('theme_location' = & gt; 'primary', ' Container '= & gt; false,' menu_class '=> NAV uppercase font-primary', 'walker' => New Vntd_Custom_Menu_Class ())); } Else {echo '& lt; Span class = "vntd-no-nav" & gt; No custom menu created! & Lt; / Span & gt; '; }} And {if (has_nav_menu ('SECONDARY_MENU_NAME')) {wp_nav_menu (array ('theme_location' = & gt; 'SECONDARY_MENU_NAME', 'container' = & gt; wrong, 'menu_class' = & gt; nav uppercase font-secondary ',' Walker '=> New Vntd_Custom_Menu_Class ())); }} Change  

SECONDARY_MENU_NAME with the name of the new menu that you created. You will need to create this in your function file.


No comments:

Post a Comment