• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Remove :active state from main menu item when on homepage

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Remove :active state from main menu item when on homepage

This topic is: resolved

Tagged: anchor link

  • This topic has 4 replies, 2 voices, and was last updated 8 years, 4 months ago by Ben Siegfried.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • February 2, 2015 at 3:46 pm #139447
    Ben Siegfried
    Member

    I know how to do anchor links to take you to a position on a page or to another specific area on a different page, for example. I am trying to do the same thing with the trigger being a main menu (Services menu link) item and the target being some area further down the homepage. I have succeeded in doing this but when you're on the homepage the :active state on the trigger (Services menu link) is there. When you're on a different page naturally it isn't there. I've tried targeting the :active state for this specific menu item to no avail. Is there a way to do what I want without the :active link state showing for the trigger (main menu item)?

    http://dev.siegfriedmedia.com
    February 2, 2015 at 10:27 pm #139476
    Lauren @ OnceCoupled
    Member

    Well, the link is 'active' because WordPress is recognizing that the base URL is the same as your current page, and therefore is adding classes like current-menu-item current_page_item.

    If you want it removed from all pages, you just have to change your style sheet to remove those styles.

    If you want it removed from just the home page, you could use the .home selector to remove it. That said, even if the user was at that particular anchor tag, you wouldn't see an 'active' link.

    Here's what the CSS might look like:

    .home .genesis-nav-menu .current-menu-item > a {
    	background-color: none;
    }

    Best,
    Lauren


    We create mobile-first, PageSpeed-optimized, pixel-perfect custom themes! https://www.oncecoupled.com

    February 2, 2015 at 10:56 pm #139482
    Ben Siegfried
    Member

    Oh thank you so much for this! I did not try ".home"

    background-color: none; did not work.

    This is what actually works to get it all to behave as a normal menu item:

    .home .genesis-nav-menu li a:hover {
    	background-color: rgba(255, 255, 255, 0.1);
    }
    
    .home .genesis-nav-menu .current-menu-item > a {
    	background-color: rgba(0, 0, 0, 0);
    }
    February 2, 2015 at 11:02 pm #139483
    Lauren @ OnceCoupled
    Member

    Hm, I tested that code before I posted it. All the same -- glad it's working!


    We create mobile-first, PageSpeed-optimized, pixel-perfect custom themes! https://www.oncecoupled.com

    February 2, 2015 at 11:27 pm #139485
    Ben Siegfried
    Member

    Thanks again for clueing me in on that one!

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble