Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Web Design (WordPress, Joomla, etc.) How to add .active class to WordPress 3.0 CSS menus?

  • How to add .active class to WordPress 3.0 CSS menus?

    Posted by Clint Milner on October 7, 2011 at 10:38 am

    Hi All,

    I’m developing a WP theme for my company and I’m looking for a little advice on for my navigation bar.

    https://dev.cd-duplication-in-the-uk.com/disc-printing/screen/ is an example page…

    The main nav menu is 100% CSS and ideally I’d like to give the user some notification to which page they’re on.

    For this example, I’d like to have “disc printing” as well as “screen” visible and colored blue.

    Looking at the source, it seems like there are certain classes that are specific to these my two menu targets, but I can’t get the CSS to activate.


    nav.main li.current-menu-item,
    nav.main li.current_page_item,
    nav.main li.current_page_parent,
    nav.main li.current-page-parent,
    nav.main li.current_page_ancestor,
    nav.main li.current-post-ancestor { color: #036; }

    Once I get the blue to activate, I’d also like the sub-menu to stay visible as well… is there a trick to that?

    Many thanks for you time,
    Clint

    Adobe CS4 Master Suite
    Vista Ultimate 64 SP1
    Intel Core i7 920 @ 3.60GHz
    12 GB DDR3 RAM
    NVidia Quadro FX 3700
    Matrox RT.X2 LE Capture Card
    4 TB RAID 5

    Clint Milner replied 14 years, 7 months ago 1 Member · 1 Reply
  • 1 Reply
  • Clint Milner

    October 7, 2011 at 11:49 am

    UPDATE:

    I’ve been able to use this code:

    ul.menu li.current-menu-parent a {color: #036;}
    ul.sub-menu li.menu-item a {color: #999;}
    ul.sub-menu li.current_page_item a {color: #036;}

    It seemed to be a CSS precedence issue.

    What I can’t figure out how to do is to have the sub nav bar show when one of its sub-pages are active.

    Can someone help me out with this one?

    Thanks,
    Clint

    Adobe CS4 Master Suite
    Vista Ultimate 64 SP1
    Intel Core i7 920 @ 3.60GHz
    12 GB DDR3 RAM
    NVidia Quadro FX 3700
    Matrox RT.X2 LE Capture Card
    4 TB RAID 5

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy