• 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

Applying CSS to Links on Current Page

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 › General Discussion › Applying CSS to Links on Current Page

This topic is: resolved

Tagged: active, color, css, current link, executive pro, genesis, link

  • This topic has 1 reply, 1 voice, and was last updated 11 years, 1 month ago by Nathan.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • November 25, 2014 at 8:56 am #132752
    Nathan
    Member

    I've recently started working with wordpress and with the site up and running I want to add a few cosmetic changes. I'm using genesis with a fairly modified executive pro child theme. The issue I'm having is getting my side bar links to change background color when the page is current (visual feedback, so the user knows what page they're on). I've tried multiple solutions posted by others on the forums but unfortunately none are working for me. Locally I write a very simple page to see if I could get it to work with the JQuery method.

    <script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
    <script>
    $(function(){
      $('a').each(function() {
        if ($(this).prop('href') == window.location.href) {
          $(this).addClass('currentPage');
        }
      });
    });
    </script>

    And it works perfectly. So I decided to try it on my development wordpress site and unfortunately it's not working. I added the scripts into the header box in the genesis tab, I've put all my sidebar links in a div tag with custom css class (sidebars are via genesis simple sidebars). And added the appropriate css classes/code into my theme.css file.

    .test a{
    	padding: 10px 10px 2px 2px;
    	color:#64C9EA;
    	text-decoration:none;
    }
    
    .test a.currentPage {
    	background:black;
    }

    Any ideas?

    Thanks,
    Nathan

    November 25, 2014 at 9:56 am #132762
    Nathan
    Member

    Managed to fix it, changed the code to this and removed <script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>.

    <script>
    jQuery(document).ready(function($){
      $('a').each(function() {
        if ($(this).prop('href') == window.location.href) {
          $(this).addClass('currentPage');
        }
      });
    });
    </script>
  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘General Discussion’ 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

© 2026 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