• 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)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    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?

    Thread Starter Shr.Khr

    (@shrkhr)

    Hi Andrew
    I am actually creating a child theme.

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

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

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

    Thread Starter Shr.Khr

    (@shrkhr)

    Please check now. It should be visible.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    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;
    }

    Thread Starter 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.