• I’m trying to target the current page item so I can highlight the navigation when the user is on the given page. I’m not sure if my error is the way that I’ve installed the navigation because when I view the code in firebug I do not see the current_page_item attached to the given page.

    This is what calls my menu :
    <?php wp_nav_menu(array('menu' => 'Main Nav Menu')); ?>

    This is what is in my functions:

    `if (function_exists(‘register_nav_menus’)) {
    register_nav_menus(
    array(
    ‘main_nav’ => ‘Main Navigation Menu’
    )
    );
    }`

    And no matter what I put in the css I can not get the current page item to show. Any help would be great.

Viewing 4 replies - 1 through 4 (of 4 total)
  • without seeing what is going on, it is quite impossible to make any suggestions.

    link to your site?

    And no matter what I put in the css

    what have you tried so far?

    Thread Starter meganlee1984

    (@meganlee1984)

    Here is the link: https://analogimpulse.net/new/

    To this post, which seems to have been taken down:
    Can you see the “current_page_item” class in the current page li tag?
    <li class=”….. current_page_item >Home
    if so you can style it like this
    #YourNavigationID ul li.current_page_item a{ color:#fff;}
    check whether this helps

    I can not see the “current_page_item” class in the current page li tag.

    I have tried this already:

    #menu-sidebar-menu li.current_page_item a {color: #FFF !important;}
    
    #menu-sidebar-menu ul li.current_page_item a {color: #FFF !important;}
    
    #sidebar li.current_page_item a {color: #FFF !important;}

    Thank you.

    try to add a wp_reset_query();
    either directly at the start von sidebar.php;
    or directly before you call the menu.

    https://codex.www.ads-software.com/Function_Reference/wp_reset_query

    i have the suspicion, that some custom query in the content area is not closed properly and has distorted the original querystring.

    Thread Starter meganlee1984

    (@meganlee1984)

    Yes! That was it, thank you very much Alchymyth.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Can't target Current Page’ is closed to new replies.