Forums

[resolved] How to keep active class in main navigation when single post is viewed? (3 posts)

  1. eatanicecream
    Member
    Posted 2 years ago #

    Hi folks

    I'm wondering how keep the active class in the main nav (wp_page_menu) when a single post is viewed?

    Compare http://whoshouldicheerfor.com/2010/05/the-first-post/

    with

    http://whoshouldicheerfor.com/blog/

    For example.

    Many thanks

  2. dor
    Member
    Posted 2 years ago #

    "Blog" in the first post is in class "current_page_item" while in the "blog" page in is in class "current_page_parent". All is well.

    You need to modify either style.css or header.php.

    style.css would be better place for that.

    Something like this ("not tested", be sure):
    div#navigation div.menu li.current_page_parent {
    /* copy something from definitions for li.current_page_item */
    }

    HTH,

    /dor

  3. eatanicecream
    Member
    Posted 2 years ago #

    Brilliant, that did it. Thank you very much.

Topic Closed

This topic has been closed to new replies.

About this Topic