• My site is in maintenance mode.

    I have a navigation menu at the top on all pages. If you click About, you’re taken to that page and the color for About changes to blue and stays blue.

    There is also a Home link. When you first pull up my website, the Home link is the standard black color for the body text. It only turns blue when you click the link and it becomes active.

    How do I make the Home link the active color whenever someone is on the homepage, without them having to click that link?

    I’ve seen this on many websites, but I just can’t find the right search terms to help me find the steps needed to do this.

    Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • To make home link active by default write css for it. What is the URL of your site.

    Right-click on your ‘Home’ link (like in Firefox) and take a look at your code. In my own case, here is what you are asking about:

    #header .logo h1 a{color:#003399;} /* our Dark blue */
    #header .logo h1 a:hover{text-decoration:underline;color:#0033cc;} /* our strong blue */

    The ‘#header .logo’ part of that will almost certainly be different in your own theme, but there is where you can set your color/s.

    edit: Oops, I did not see your post, mm_developer!

    Thread Starter Coyotefrogger

    (@lovesmoose)

    My site is in maintenance mode. I don’t want to take it out of maintenance mode right now.

    The nav links at the top of my website: Home About Contact FAQ Shop

    They appear on all pages. But ONLY when someone is on the Home page do I want the Home link active.

    When you enter the URL and visit my site directly, the Home link is not active, even though you are on the Home page. The only way to make the active link color appear is when you click on the Home link.

    But I don’t want the Home link to be the active color unless someone clicks it to get to the homepage, or they are on the homepage because they just arrived there and haven’t navigated around yet.

    It almost sounds like this would have to be a function, or if CSS is used, I would have to separate the Home link from the others and indicate that the Home link on the homepage is always to remain blue.

    But I’m not sure how to do this.

    I do not know exactly how to do this and the following is not tested, but you could add something like this to header.php and then style it in style.css:

    <div class="colorhome">
    	<?php if(is_home()||is_front_page()){?>
    		<h1><a href="<?php echo esc_url( home_url('/'));?>" title="<?php bloginfo('name');?>"><?php bloginfo('name');?></a> </h1>
    	<?php }?>
    </div>

    https://www.google.com/search?q=wordpress+is_home+is_front_page

    Thread Starter Coyotefrogger

    (@lovesmoose)

    That’s what I thought I’d need to do. Thanks for your help.

    I haven’t tested it yet and am trying to learn best practices for this, but I am not finding anything that makes it clear and easy to understand.

    I often see the home link in a special color on the homepage, without having clicked anything. So I know it can be done. In fact, I think some child themes even come that way, so it’s not uncommon.

    I’m just not sure how to do this without creating a problem. I’ll experiment with the code you shared, though, and see how it goes.

    Again, thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to keep the 'Home' link the active color on the homepage’ is closed to new replies.