How Not to Display the “Home” Title on your WordPress Website

This article will show you how to remove the page title form the home page, but display it on all of the other pages. This is very useful if you are using WordPress as a content management system (CMS). It assumes that you are using a static home page, which you configured in your WordPress Admin under Reading.

First, open up page.php. You can find it under wp-content -> themes -> yourtheme.

Look for the title tag. It should look something like this:

<h2><?php the_title(); ?></h2>

Change to this:

<?php
				// let's generate info appropriate to the page being displayed
				if (is_front_page()) {
				        // we're on the home page, so let's not show page title
				        echo "";
				} else {
				        // catch-all for everything else (archives, searches, 404s, etc)
				        echo "<h1 class=\"title\">";
				        the_title();
				        echo "</h1>";
				} // That's all
				?>

Let’s walk through it. The first if statement tells WordPress that if this is the front page don’t display the page title. The else statement tells WordPress that if this is not the front page, display the page title. I also changed the header tag to an H1, instead of an H2. If you change it to an H1, remember to change your CSS.

Share and Enjoy:
  • Print
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks
  • Add to favorites
About Jeffrey Horen

I am the owner of Excelnet Media. We are a full service, one stop interactive web agency building extraordinary websites with extraordinary customer service for extraordinary clients.

Comments

  1. Thanks for tip on not showing the Home title in WordPress This should be built in for each page.
    JV

Speak Your Mind

*