WordPress.org

Support

Support » How-To and Troubleshooting » Exclude home link on home page

Exclude home link on home page

  • I can’t find search results to show me how to exclude the link to my home page when the page being viewed IS the home page. I can exclude a page from the header entirely and in fact do this with a couple of my pages. What I want is for the home page link to show on all pages except my home page.

    Thanks for instructions or a link to a thread or codex where it is explained.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Add something like this to your index.php template file:

    <?php if( is_home() ) : ?>
    
      <h1><a href="/">Home</a></h1>
    
    <?php else : ?>
    
      <h1>Home</h1>
    
    <?php endifl ?>

    As another example, I found the following in my header.php file:

    <?php wp_list_pages('title_li='); ?>

    You could replace it with:

    <?php
      if ( is_home() )
        wp_list_pages('title_li=');
      else
        echo "<a href='http://domain/path_to_wp/'>Home | </a>";
        wp_list_pages('title_li=');
      endif
    ?>

    Change the href to point to your WP installation. Check wp_list_pages() in the Codex for other options.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Exclude home link on home page’ is closed to new replies.
Skip to toolbar