• Resolved thirteen

    (@thirteen)


    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.

Viewing 11 replies - 16 through 26 (of 26 total)
  • Thread Starter thirteen

    (@thirteen)

    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=');?>

    Thread Starter thirteen

    (@thirteen)

    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. https://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!

    Thread Starter thirteen

    (@thirteen)

    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 ??

    Thread Starter thirteen

    (@thirteen)

    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 ??

    Thread Starter thirteen

    (@thirteen)

    That worked! Thank you ??

    No problem ??

Viewing 11 replies - 16 through 26 (of 26 total)
  • The topic ‘Active page link colour’ is closed to new replies.