Creating a Title-less Home Page
(If you’re just tuning in, this is the seventh installment of my series of articles about using WordPress as a CMS to build an informational Web site. Throughout this series, I’m talking about a specific site I developed: Flying M Air, a helicopter tour and charter company I operate when I’m not writing and tweaking my Web sites.)
I decided early on that I wanted my site to have a static home page that provided basic information about my company. Visitors could then use the links along the top of the page to view more information in other static pages or the links in the right column to learn more about specific tours and other services.
The Andreas theme I’d modified included page links along the top of the page. As I mentioned in Part 3 of this series, I created the pages and used the Page Order option to assign numbers to the pages that would determine their order. The theme automatically listed the pages by name as a row of buttons at the bottom of the header, using the following code:
Remember, the CSS code in style.css is what determines the appearance of the links on the site.
I created a home page, gave it a title of Home, and assigned a Page Order value of 0. That put it at the beginning of the list, right where a Home page button should appear. My Home page included random images (covered in Part 5 of this series) and text with links.
Now I needed to make that page be the page that appeared automatically when someone went to the default page of the root directory — in other words, www.flyingmair.com. I used the Static Front Page plugin by Denis de Barnardy. Miraz covered this plugin in our WordPress book, so I don’t want to go into a lot of detail about it here. I simply installed and activated the plugin, then confirmed that the Post Slug for the Home page was home. My Home page was the static Home page.
This may have satisfied a lot of people, but not me. The problem was, the page title (Home) appeared at the top of the Home page. I didn’t want it to appear at all. So I had one more thing to do.
Like all other Pages on a WordPress-based site, my Home page was displayed with the page.php file. I opened the file and inserted some conditional code (shown in bold type) around the instruction to display the title near the beginning of The Loop:
<strong><?php if (is_home()) { ?><?php } else { ?></strong><h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a> <?php edit_post_link('<img src="'.get_bloginfo(template_directory).'/images/pencil.png" alt="Edit Link" />','<span class="editlink">','</span>'); ?></h2><strong><?php } ?></strong>
Here’s how it works.
<?php if (is_home()) { ?>says that if this is the home Page, display what comes next. But that’s followed immediately by<?php } else { ?>, so nothing is displayed.<?php } else { ?>says that if this is any other Page, display what comes next. That’s the title as a H2 heading and link, as well as the icon I’m using for displaying an Edit link.<?php } ?>says to stop acting on the is_home conditional statement; the rest of the content should appear for all Pages.
The result: for any Page except the Home Page, the Page title appears at the top of the page.
I think that just about covers all of the special features I included in Flying M Air’s new WordPress-based Web site. Did I leave something out? Use the Comments link if you think there’s another topic I could cover in this series. Otherwise, I’ll call it quits for now.
But don’t worry; there are plenty of other WordPress-related tips and topics I can share. Keep checking in for more.
And now, can I interest anyone in a helicopter tour?
Previous Entries in this Series:
- Part 1: I Discover that WordPress Makes an Excellent Content Managment System
- Part 2: Finding and Modifying Just the Right Theme
- Part 3: Planning the Site’s Organization and Creating the Pages
- Part 4: Adding Category-Specific Post Links to the Sidebar
- Part 5: Adding Random Images
- Part 6: Adding Print and E-Mail Features












