Active page link colour
-
Hello,
I’m trying to figure out why the “News” link at the top of my page is not changing colours (like the “About” page) when active. I set it as the home page (through Settings > Reading), so I’d like the active link to be the correct colour when the user is on the home page AND the News page. Or at least the News page.
Any help would be appreciated.
-
Thanks, I’m going to look into it some more and see if there’s a work-around. I really want the “news” link in the top to show itself as active when you’re on the home page.
Try this
<li><a class="current_page_item" href="<?php <?php echo home_url(); ?>/" >News</a></li> <?php wp_list_pages('sort_column=menu_order&depth=1&title_li=');?>Doesn’t seem to work. Thanks for your help so far. I will check back later…
or
<li class="current_page_item"><a href="<?php <?php echo home_url(); ?>/" >News</a></li> <?php wp_list_pages('sort_column=menu_order&depth=1&title_li=');?>Both tested on your site via chrome dev tool. http://postimage.org/image/31cspn738/
oops!
<li class="current_page_item"><a href="<?php echo home_url(); ?>/" >News</a></li> <?php wp_list_pages('sort_column=menu_order&depth=1&title_li=');?>didn’t display right there was an extra php sorry!
The issue with that is it’s hard-coded, which means the “news” will remain highlighted on every other page too.
for weird reason I am keep pasting an extra <?php I am so sorry about that
please see the last one <?php echo home_url(); ?> above this post. My bad πDon’t worry about the extra PHP, I’m just deleting it.
<li class="<?php if ( is_home() ) { echo "current_page_item"; } ?>"><a href="<?php echo home_url(); ?>/" >Home</a></li> <?php wp_list_pages('sort_column=menu_order&depth=1&title_li=');?>Last try π
That worked! Thank you π
No problem π
The topic ‘Active page link colour’ is closed to new replies.