WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Highlight the homepage item in navigation (2 posts)

  1. kReEsTaL
    Member
    Posted 7 years ago #

    Hello,

    Here is my blog. Thanks to wp_list_pages and to wp_list_categories, with some CSS work, I can show the readers where they are located when they browse the site. I.e if they're browsing the "Pensées" category, the category list item "Pensées" goes bold.

    It works for my category list as well as my navigation list, that includes "A propos de Marie" until "Contact".

    However, I added another link at the top of the navigation link which is "Accueil" (= "Home"), which does not belong to the wp_list_pages loop. I would like it to go bold, too, when you are located on my blog's root, that is to say bon http://www.bloodymarie.fr

    How can you make this possible?

    Many, many thanks for your precious help!*

  2. kReEsTaL
    Member
    Posted 7 years ago #

    The solution is:
    <li <?php if(is_home()){echo 'class="current_page_item"';}?>><a href="<?php bloginfo('siteurl'); ?>" title="Homepage">Homepage</a></li>

Topic Closed

This topic has been closed to new replies.

About this Topic