• Resolved riotstarone

    (@riotstarone)


    I want to change current menu item color. I tried to edit from these element but it does not work:
    .primary-navigation .current_page_item > a, .primary-navigation .current-menu-item > a, .primary-navigation .current_page_ancestor > a { }
    Please help me. Link: https://www.devreveal.com/
    Thank so much.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The only thing you are missing is a color property:

    .primary-navigation .current_page_item > a,
    .primary-navigation .current-menu-item > a,
    .primary-navigation .current_page_ancestor > a {
       color: #f00;
    }

    This will make the current menu item red. Be sure to add the CSS using either the theme’s Custom CSS option (if it has one) or create a child theme, or use a CSS plugin like Jetpack or Custom CSS Manager. Don’t edit the theme files directly. If you do so, then your changes will be lost the next time you update the theme.

    Thread Starter riotstarone

    (@riotstarone)

    Thank you very much for your support. But it’s not working. I tried many ways like this. But it still not working. ??

    Thread Starter riotstarone

    (@riotstarone)

    I think the main reason here: .current_page_item > a But attempt to do anything will not effect. I tried lots of solutions. Help me please.

    How and where did you add the code? I still see the old CSS rule, without the color property. Can you please deactivate Yoast temporarily? Sometimes Yoast will cache the web pages so updates don’t show up right away.

    Thread Starter riotstarone

    (@riotstarone)

    Hi CrouchingBruin. I changed directly in Appearance Editor, I also flushed cache but nothing happen. Please check it again.

    What file did you change in Appearance → Editor? When I look at your style.css file, I see this at line 213:

    .primary-navigation .current_page_item > a, .primary-navigation .current-menu-item > a, .primary-navigation .current_page_ancestor > a { }

    Thread Starter riotstarone

    (@riotstarone)

    Yes. It’s Appearance → Editor Currently, it has effect after over 5 hours. I don’t know why. By the way, thank you very much. But why it won’t effect immediately? Secondly, why when I choose read a post from “Objective-C” category, the menu item “Objective-C” does not have red color style like I click on it.

    This…

    .primary-navigation .menu li.current_page_item a,
    .primary-navigation .menu li.current-menu-item a,
    .primary-navigation .menu li.current_page_ancestor a {
       color: #f00;
    }

    Thread Starter riotstarone

    (@riotstarone)

    Hi, both of you guys. I would like to thanks you all. Currently, the problem has been resolved, The changing effected after clear cache on browser and server as well. But Could you help me with the issue when I click on a post, for example: https://www.devreveal.com/properties-in-objective-c/
    This post belong to Objective-C category. I want when a post, which is being reading located on a category, that category should be use the style.
    In fact, the style just affect when we click on menu item on navigation.
    Please help me, Thanks again.

    Try this…

    .primary-navigation .menu li a:hover,
    .primary-navigation .menu li a:focus,
    .primary-navigation .menu li.current_page_item a,
    .primary-navigation .menu li.current-menu-item a,
    .primary-navigation .menu li.current_page_ancestor a {
       color: #f00;
    }

    Did you change the background-color?

    Sorry, I misunderstood the request. This should do it…

    .primary-navigation .menu li.current-post-ancestor a,
    .primary-navigation .menu li.current-menu-parent a,
    .primary-navigation .menu li.current-post-parent a,
    .primary-navigation .menu li.current_page_item a,
    .primary-navigation .menu li.current-menu-item a,
    .primary-navigation .menu li.current_page_ancestor a {
       color: #f00;
    }
    Thread Starter riotstarone

    (@riotstarone)

    Thank you very much @neotechnomad
    It worked.

    Good! If that is all, then you could mark this thread “Resolved”.

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