Support » Themes and Templates » Change color of current menu item

  • Resolved Shr.Khr

    (@shrkhr)


    I am experimenting with a theme for WP 3.5 which can be found here.

    For hours now I have been trying to change the color of the current menu item, however my efforts have been fruitless.

    So, I was hoping that someone here can help me.

    This is what I am trying to achieve:

    When I am on the ‘Home’ page, I want its menu text color to change to blue, while the others will remain black.

    When I am on the ‘Sample Page’ page, I want its menu text to turn blue while the others will remain black.

    I can see in the style.css file that there is a ‘current-menu-item’ rule; but I am unable to use it.

    Can someone please tell me what CSS to use here.

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

    (@anevins)

    Forum moderator

    Have you tried this;

    .current_page_item a {
     color: #08c;
    }

    You shouldn’t be editing the theme’s files if that’s what you’re doing. Are you?

    Shr.Khr

    (@shrkhr)

    Hi Andrew
    I am actually creating a child theme.

    And unfortunately, the style you mentioned above does not work.

    Moderator Andrew Nevins

    (@anevins)

    Forum moderator

    Where did you add it? Unless the change is visible on the website, I can’t debug it.

    Shr.Khr

    (@shrkhr)

    Please check now. It should be visible.

    Moderator Andrew Nevins

    (@anevins)

    Forum moderator

    The issue here is that another stylesheet is overriding your CSS changes.

    Add !important to the end of your style,
    E.g;

    .current_page_item a {
     color: #08c !important;
    }

    Shr.Khr

    (@shrkhr)

    Top man!
    It works! Thanks!

    So, I have changed the status of this topic to resolved.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Change color of current menu item’ is closed to new replies.