WordPress.org

Ready to get started?Download WordPress

Forums

Page scroll to id
[resolved] Want to highlight "Blog" menu when viewing individual blog post (3 posts)

  1. Jane
    Member
    Posted 3 months ago #

    My site is: http://www.jswebsitedesign.com

    I'm able to get the menu item associated with the current section to highlight nicely when I click on any of the top menu items. (thanks for your help with this!)

    However, when I click on one of the Blog posts, such as "Breathing Space", I want the "Blog" menu item to be highlighted in green (#85C441) and it's not. I added a "<div id="blogPage"> ... </div> wrapper around the "Breathing Space" blog post as a test, but it didn't fix this issue. If you have any suggestions for how I can get the "Blog" menu item to highlight when I'm on an individual Blog post I'd appreciate it.

    Thanks in advance for your help.

    https://wordpress.org/plugins/page-scroll-to-id/

  2. malihu
    Member
    Plugin Author

    Posted 3 months ago #

    Your blog posts pages body tag gets the class single-post by WordPress. You could use this class in your CSS to target the 'Blog' menu item:

    .single-post #top-menu li.menu-item-79 > a{
        color: #85C441;
    }

    This way the green color is applied only on .menu-item-79 (your 'Blog' link) and only when under the .single-post (the single-post page body class).

  3. Jane
    Member
    Posted 3 months ago #

    Hi Malihu - Thanks for this solution! It worked perfectly.

Reply

You must log in to post.

About this Plugin

About this Topic