• Resolved yuncreativelabs

    (@yuncreativelabs)


    Hello!
    I’m having troubles highlighting the current page I am in. I tried using the wp tag, like “li.current_page_item a” but it’s not working…

    This is how the menu gets called:

    <div id="menu_wrap"><div class="center"><div id="topmenu"><?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?></div></div></div>

    Thanks in advance!
    Giulia

Viewing 10 replies - 1 through 10 (of 10 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Use a Browser Inspector Tool to explore what class is applying to your list. Alternatively view your webpage’s source and search there.

    Thread Starter yuncreativelabs

    (@yuncreativelabs)

    <div id="menu_wrap">
    <div class="center">
    <div id="topmenu">
    <div class="menu-header">
    <ul id="menu-menu1" class="menu">
    <li id="menu-item-26" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-26">
    <a href="#">home</a></li>
    <li id="menu-item-33" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-33"><a href="#">Gallery</a>

    then following the other elements…

    WPyogi

    (@wpyogi)

    Without seeing the site, almost impossible to help with things like this — as CSS is totally site-specific and may be affected by other CSS code on a page.

    Michael

    (@alchymyth)

    is that the html of the menu when you are on the home page or gallery page?

    is there any ‘current-menu-item‘ or similar in any of the ‘following other elements’?

    https://codex.www.ads-software.com/Function_Reference/wp_nav_menu#Menu_Item_CSS_Classes

    Thread Starter yuncreativelabs

    (@yuncreativelabs)

    sorry the code I posted wasn’t helpful at all.

    I am on the “about” page, which is exactly as “gallery”..
    the line you are talking about (the one with the “current”) is this:

    <li id="menu-item-40" class="menu-item menu-item-type-post_type menu-item-object-page current-menu-item page_item page-item-38 current_page_item menu-item-40">
    <a href="#">About</a>
    </li>

    I know it says “current-menu-item” but I can’t get it to work in the css… ??

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Perhaps you’re not using specific enough selectors.

    WPyogi

    (@wpyogi)

    Current menu item likely shows up in every menu item? If you want to target a specific page, you need to use a unique class or id for that page — perhaps id=”menu-item-40″ ?

    Thread Starter yuncreativelabs

    (@yuncreativelabs)

    oh god…I think I might need a little help on this.
    it’s just not fair that when it is about me things are always this complicated…gah!

    I’ll give it ago as soon as I have a little more time…thank you very much for your help guys!
    if you hear from me again here it means I have failed :/

    Thread Starter yuncreativelabs

    (@yuncreativelabs)

    Hi again…
    I tried it all but couldn’t get it to work.
    If someone would give some of his time to figure it out I’d be very grateful.
    This is the link pointing to one of the pages: https://www.yuncreativelabs.com/wp/gallery/

    Thanks a lot ??

    Thread Starter yuncreativelabs

    (@yuncreativelabs)

    Just writing to let you know that I won.
    thanks everybody for your help though!!!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Current page’ is closed to new replies.