WordPress.org

Forums

[resolved] highlight parent pages on menu, when child page is showing (10 posts)

  1. nagia_amrit
    Member
    Posted 2 years ago #

    hi,

    I'm using twenty eleven, i have created a child theme already, no website preview available as currently is on localhost.

    The thing is i have a custom menu on top of the page eg "Home", "About us" , etc

    Now i have several pages under About Us eg our team that underneath has other pages (these pages are not visible on the menu, i used custom menu) and when someone sees them, i want the About us page to be highighted.

    I've changed the

    #access li.current-menu-item,
    #access li.current-menu-ancestor,
    #access li.current-menu-parent,
    #access li.current_page_item,
    #access li.current_page_ancestor,
    #access li.current_page_parent{
    font-weight: bold;
    color: #003f87;
    }

    but it doesn't work.

    Any help/advice appreciated

    Many thanks :)

  2. Andrew
    Forum moderator
    Posted 2 years ago #

    Can you Pastebin.com your HTML and CSS for this menu?

  3. nagia_amrit
    Member
    Posted 2 years ago #

    Hi Andrew yes

    html
    css

    many thanks

  4. Andrew
    Forum moderator
    Posted 2 years ago #

    I can only see a 'home' menu item.
    Can you grab the HTML from the 'view-source' window of the web page?

  5. nagia_amrit
    Member
    Posted 2 years ago #

    html

    sorry for that

  6. Andrew
    Forum moderator
    Posted 2 years ago #

    Does the list item, that has children, have the classes you're specifying in the CSS?
    It's just the code you've linked doesn't have any children elements and therefore neither ancestral/ parent classes.

  7. nagia_amrit
    Member
    Posted 2 years ago #

    oh ok thanks

    is it cause i'm trying to link a page to the menu?
    should i create a class for that?

  8. Andrew
    Forum moderator
    Posted 2 years ago #

    Yes these classes should be created somehow to relevant menu items

    current_page_ancestor

    and

    current_page_parent
  9. nagia_amrit
    Member
    Posted 2 years ago #

    many thanks :)

  10. nagia_amrit
    Member
    Posted 2 years ago #

    Hi Andrew,
    i've done that, but the thing is, that i have created a custom menu. which doesn't have any subpages (drop down) only the main pages eg Home, About Us, Services etc. However, each page has a diff sidebar. I am trying to highlight the pages on the menu whenever a page from the sidebar is selected(and of course i have already added the menu page as a parent). (if that makes any sense)
    It's working on the custom menu, if i drag and drop the pages under its parent one. But i don't want that. I don't want the drop down menu. Is there a way to do it? Either hide the dropdown menu but keep its settings?

Topic Closed

This topic has been closed to new replies.

About this Topic