WordPress.org

Ready to get started?Download WordPress

Forums

Exclude home link on home page (3 posts)

  1. Will Taft
    Member
    Posted 6 years ago #

    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.

  2. microkid
    Member
    Posted 6 years ago #

    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 ?>
  3. bradford-online
    Member
    Posted 6 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.