Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Highlighting a link when it is on the current page

  • Hi there,

    I have a mini “category menu” on some of my pages, which is inserted as a Pattern.

    I would like to highlight the link when it matches the current page that I am in.

    Can this be done by CSS only? Have done a lot of searching, but I’m mainly seeing solutions on navigation menu items.

    Thanks in advance!

  • Hi there,

    Can this be done by CSS only? Have done a lot of searching, but I’m mainly seeing solutions on navigation menu items.

    Unfortunately not. It works for menu items as WordPress adds unique classes current-menu-item current_page_item:
    https://www.screencast.com/t/YVXim2EGb

    And WP does not add a unique class to the activated link, unfortunately.

    Sorry about that!

  • Thanks for the reply. May I know if there is a different way to do it?

  • Not I’m aware of. This is the default WordPress behavior so not something the theme can control.

    You would need a custom JavaScript solution to add a unique class to the activated link. If it’s required for your build then you can consider hiring a developer using a service like Codeable suggested at the bottom of this page: https://generate.support/what-support-includes/

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.