Forums

[resolved] can i turn off active highlighting on the "home" menu item? (8 posts)

  1. fifthhouse
    Member
    Posted 2 years ago #

    I want to turn off active highlighting on the "home" menu item when other pages are clicked on. As it is now the "home" is always highlighted no matter what page I click on in my top menu.

    When I click on "about" for example, both "home" and "about" are then highlighted. I would like it so that only the page menu item that i click on is highlighted.

  2. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    Site url?

  3. fifthhouse
    Member
    Posted 2 years ago #

  4. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    Try editing header.php and looking for wp_list_pages. Immediately above, try changing:

    <li class="current_page_item"><a href="<?php bloginfo('url'); ?>">Home</a></li>

    to

    <?php if( is_front_page() || is_home() ) $h_style = ' class="current_page_item"';
    else $h_style ='';?>
    <li<?php echo $h_style;?>><a href="<?php bloginfo('url'); ?>">Home</a></li>
  5. fifthhouse
    Member
    Posted 2 years ago #

    In my header.php the closest I could find is:

    <li class="current_page_item<?php if (is_home()) echo ' current_page_item'; ?>">/">Home
    <?php wp_list_pages('title_li=' ); ?>

    It's different, but is this the code I should change?

  6. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    Just try changing the first line. Leave <?php wp_list_pages('title_li=' ); ?> alone.

  7. fifthhouse
    Member
    Posted 2 years ago #

    Got it. That worked perfectly!
    Thanks very much for your help :)

  8. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    Glad to hear you got it sorted. :-)

    The "resolved" checkbox is just over there -->

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.