Support » Fixing WordPress » Color of the current page link

  • Hello,

    I’d like to force the color of the current page link, located in the primary sidebar : having inserted the following commands in the child 2014 theme style.css, I can’t get any change.
    Would anybody tell me what’s missing ? (I’m working on a local installation of WP).

    .current-menu-item a { color: #55d737 !important; }
    .current-menu-item a:hover { color: #55d737 !important; }

    Typically, here is the page driving “Le son du musicien” link of which I want to force the color when this page is displayed :

    <div id="secondary">
    		<h2 class="site-description">de Guy Robert</h2>
    
    		<nav role="navigation" class="navigation site-navigation secondary-navigation">
    		<div class="menu-au-fait-container"><ul id="menu-au-fait" class="menu"><li id="menu-item-18" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-18"><a href="http://www.lhappyjazz.com">Venez à L&rsquo;Happy Jazz</a></li>
    </ul></div>	</nav>
    
    		<div id="primary-sidebar" class="primary-sidebar widget-area" role="complementary">
    		<aside id="tag_cloud-6" class="widget widget_tag_cloud"><h1 class="widget-title">Vos mots-clés</h1><div class="tagcloud"></div>
    </aside><aside id="nav_menu-8" class="widget widget_nav_menu"><h1 class="widget-title">Le son</h1><div class="menu-le-son-container"><ul id="menu-le-son" class="menu"><li id="menu-item-151" class="menu-item menu-item-type-post_type menu-item-object-page current-menu-item page_item page-item-26 current_page_item menu-item-151"><a href="http://localhost:8888/wordpress/le-son-du-musicien/">Le son du musicien</a></li>

    Thanx in advance,

Viewing 3 replies - 1 through 3 (of 3 total)
  • check if the stylesheet is not broken – http://codex.wordpress.org/Validating_a_Website#CSS_-_Validation

    or rather consider to add the new CSS via a ‘custom CSS’ plugin; https://wordpress.org/plugins/search.php?q=custom+css

    are you using a browser inspection tool to verify that you are changing the CSS for the right selectors?

    did you clear the browser cache? (CTRL F5)

    Thank you for your quick answer.
    I finally obtained what I wanted with the following code : the color of the link of the current page is forced, whatever its location in the navigation menus.
    Do you think of any side effects ?

    .meta a { color: #55d737 !important; }
    .meta a:hover { color: #55d737 !important; }
    .current-menu-item a { color: #55d737 !important; }
    .current-menu-item a:hover { color: #55d737 !important; }

    Can I check the CSS of the right selectors through the page code from the browser ?

    you should be able to see from the source code in the browser, if your used selectors are added to the currently active page link; however, this would not fully tell you what CSS is used for the formatting.

    try working with a browser inspection tool (my personal choice is Firefox’ web developer add-on https://addons.mozilla.org/en-US/firefox/addon/web-developer/ ) to see what CSS gets applied …

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Color of the current page link’ is closed to new replies.