Support » Fixing WordPress » Highlight the parent page on menu when browsing the sub page

  • Resolved asdfg asdf

    (@wetwetwafu)


    how can i highlight the parent page on menu when viewing the subpages,

    the top level menu are located in my header

    then i created a template for each page which will have a sub pages.

    i used wp_list_pages(‘include’) in the templates to display their respective subpages menu.

    noww, how can i highlight the parent page menu when browsing the submenu and at the same time highlighting the subpage menu that im viewing.

    Thanks in advance, im new to wordpress and ive search this forum but i cant find the exact way to solve my problem.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You could edit your theme’s stylesheet and add highlighting using the .current_page_item,.current_page_parent and .current_page_ancestor classes.

    Thread Starter asdfg asdf

    (@wetwetwafu)

    woww thanks.. it works..

    i just duplicate this

    #menu li.current_page_item a {
    color: #b2b3b6;
    font-style:italic;
    }

    and replace .current_page_item with .current_page_parent and .current_page_ancestor

    and it works.. thanks a lot sir.

    I have the same problem , but I can’t use, wp_list_pages…so .current_page_item,.current_page_parent and .current_page_ancestor classes can’t be auto-generated by wordpress.
    I’m hard coding my navigation and would like wordpress to add a hook (class or id) for both my sub-menu current page and parent main menu category. I thought is_tree might work, but kept getting errors.. can you offer me a solution? Or step me through the proper implementation of is_tree.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Highlight the parent page on menu when browsing the sub page’ is closed to new replies.