Make a Custom WordPress Front Page

Make a Custom WordPress Front Page

There are many different things that people don’t know about little ol’ WordPress. Many people have heard that it’s a “powerful cms,” but some things that seem complicated can be easy to accomlish. A great thing about WordPress is that it allows you to have a custom front page. By default, your front page displays your latest posts. I have provided a tutorial on how to have your latest post separated from the next 4 posts so you can style and organize them differently on your front page. An example of this can be seen on this site’s front page.

Step 1

Open up your favorite text editor and save the following code as a .php file. Make sure you alter the code a little to suit your themes needs.

<?php
/*
Template Name: My Home
*/
?>
 
<?php get_header(); ?>
 
	<div id="content">
 
		<?php if (have_posts()) : ?>
		<?php $more = 0;  // this forces the read more link to work on pages ?>
		<?php query_posts("showposts=1"); // show the most recent post ?>
		<?php while (have_posts()) : the_post(); ?>
 
			// Insert Div tags and content here.
 
		<?php endwhile; ?>
 
		<?php query_posts("showposts=4&offset=1"); // show the 4 most recent posts excluding the latest ?>
		<?php while (have_posts()) : the_post(); ?>
 
			// Insert Div tags and content here.
 
		<?php endwhile; endif; ?>
 
	</div>
 
<?php get_sidebar(); ?>
 
<?php get_footer(); ?>

Step 2

Make sure your WordPress theme already has a file called “page.php”, if not then go ahead and create one. Then go ahead and uplad your page template.

Step 3

Go to the WordPress Admin and go to WRITE > PAGE.

Custom Front Page

Step 4

Title the page and then scroll down to “Advanced Options” and click “Page Template.” After that, select the page template name which you just uploaded then scroll back up and press “Publish”.

Custom Front Page

Step 5

Click on the “Settings” link in the top right corner of the WordPress Admin. Then from there click on the READING link.

Step 6

Now that you’re in the Reading section in the admin, under “Front page displays,” make sure “A static page” is selected. Then from there, select your page template name and then scroll to the bottom of the page to save the changes and you are all complete.

Custom Front Page

Delicious - Stumble Upon - Reddit - Mixx - Float

1 Comment

  • Williamsman May 9th, 2008

    This is seriously what I’ve been looking for for a while. Thaaaaaank yooooou!!!

Post a Comment

If you'd like to stay up to date with the comments, subscribe to the comment feed.