Support » Fixing WordPress » wp_nav_menu no current page in some menus

  • Resolved WhispersAndSons


    First of all, i am a newbie in WordPress and PHP … and this is my first post of a problem, so please let me know if i need to post this elsewhere … .

    I have pages with multiple menus that i made using wp_nav_menu custom menus. The primary menu is working fine … it adds current-page classes for page-menu-items or current-menu-item classes for category-menu-items. Next to this ‘primary menu’ I also have a Footer menu and a menu in the sidebar. In these menus the same pages and categories are often repeated … the categories work fine and get current-menu-item classes when they should BUT the pages don’t get a current-page class when needed (and contrary to the primary menu).

    In the functions.php i put:

    if ( function_exists( 'register_nav_menus' ) ) {
      		  'footer-menu' => 'Footer Menu',
      		  'primary-menu' => 'Primary Menu',
      		  'secondary-menu' => 'Secondary Menu',
      		  'social-menu' => 'Social Menu',
      		  'side-menu1' => 'Side Menu 1',
      		  'side-menu2' => 'Side Menu 2',
      		  'side-menu3' => 'Side Menu 3',
      		  'side-menu4' => 'Side Menu 4'

    In the rest i call the menus like so:
    <?php wp_nav_menu( array('menu' => 'Primary Menu','container_class' => 'menu-header' )); ?>

    <?php wp_nav_menu( array('menu' => 'Footer Menu','container_class' => 'bottom-menu' )); ?>

    <?php wp_nav_menu( array( 'menu' => 'Side Menu 1', 'container_class' => 'side-menu' ) ); ?>

    I have been searching for ways to find out what is happening (used firebug to find the ‘current’ class …) and i have gone through all the possible information on this forum … but no result except loading seperate css-stylesheets … could somebody suggets an elegant solution? This would be super …

Viewing 2 replies - 1 through 2 (of 2 total)
  • How you resolve it?

    Hey Ones, i was on vacation … it’s a sort of work arround … this code i put in the header.php:

    `<?php if ( is_page(‘NamePage) ) { ?>
    #sidenav .side-menu #menu-item-500 > a {color: #773d90;}
    <?php } ?>`

    So this i include in the header.php <head> section and I repeat it for each page I want to be checked for. The id and class I figure out through Firebug in Firefox.

    Hope it helped … I found this kind of solution in another topic but can’t seem to find the exact location now … hope this helps.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wp_nav_menu no current page in some menus’ is closed to new replies.