Higher Search Engine Rank

How to have a Static Home Page or First post in Wordpress

February 10th, 2009

For SEO purposes you may want to have a static first post or home page in your Wordpress site. In addition to this you may also want to show some of your latest posts or some snippets of your latest posts after your static first post.

Traditionally, when you install Wordpress and start posting to it, the last post you made will always be the first post that shows on your home page.

You may well want it to be this way, but alternatively you may want to always display a welcome message on the front page of your site.

For example on this SEO site I have a static first post displaying on my home page and I also show snippets of the latest 5 posts.

So how do you do this? Luckily it is not too complicated…

STEP ONE:

Create the welcome message that you want to display on the home page of your site. In this  post you probably want to welcome your visitors, give them a brief intro to what your website is about, encourage an optin (if applicable) and anything else you want.  Here are the instructions for creating a static home page (for Wordpress 2.7)

(1) Login to your Wordpress Admin area
(2) Click on “Pages” on the menu and select “Add New”
(3) Create your new page
(4) Remember to include your site’s main keywords in the title of the post and in a few places  throughout the post for SEO purposes
(5) Publish your page
(6) Click on “Settings” in the menu and select “Reading”
(7) From the drop down menu choose “A static page” from the selection for the “Front Page Display”
(8) Select the page that you just created from the drop down menu and click “save changes”

Once you have completed these steps if you view your site, your new welcome message should be the only thing that is displayed on the home page and the visitor can navigate via whatever widgets you have (e.g. categories, latest posts etc).

If you want to go one step further and show the last say 3, or 5 posts underneath your static welcome message, you can also do step 2.

STEP TWO

(1) The first step is to edit one of your theme files to add some code to make the home page show your latest posts underneath the welcome message. Don’t worry if you don’t understand the  PHP code.
(2) Click on “Appearance” and “Editor” in the menu
(3) Click on “Page Template”
(4) First back up this page template. This is so you can quickly and easily recover if it goes wrong. To do this just open a text editor on your computer and copy and paste the contents of page.php (the page template) into your text editor and save it.
(6) Look for the line of code that looks like this:
<?php endwhile; endif; ?>
(7) AFTER this line of code insert the following code:

<p>
<h3><font color=#990000><b>Latest posts…. </b></font></h3>
</p>

<?php $temp_query = $wp_query; ?>
<?php query_posts(’showposts=5′); ?>

<?php while (have_posts()) : the_post(); ?>
<div class=”post” id=”post-<?php the_ID(); ?>”>
<a href=”<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”><?php the_title(); ?></a>
<?php the_excerpt(); ?>
<a href=”<?php the_permalink() ?>”>Read more….</a>
</div>
<?php endwhile; ?>

(8) If you want you can edit the part that says “Latest Posts…” to say whatever you want. Or you can change from h3 to h2 or whatever you prefer.

This shows snippets of the latest 5 posts. If you want to show a different number of posts  then change the ’showposts=5′ to ’showposts=3′ or whatever number you want.

(9) Save the file

That’s it! Your Wordpress home page should now be showing a static welcome message and snippets of the latest 5 posts.

21 Responses to “How to have a Static Home Page or First post in Wordpress”

  1. Krezi Prophete Says:

    Hey Suzanne,

    Thanks so much for posting this. I found it to be very helpful.

    Wish you continued success,

    Krezi

  2. i24hrs Says:

    Suzanne,

    Thank you so much for this post. This is exactly what I plan to do with my site(s). Wordpress is really a great platform and I’m already beginning to understand its effectiveness. Not only SEO-wise but also it’s ease of use.

    I just finished reading your SEO books…great stuff and easy to understand. You mentioned about doing a Wordpress tutorial…I can’t wait.

    Hope you can also have a tutorial or possibly a service or template/theme to make the current PIPS adapt to Wordpress…not just including a Wordpress blog to it. I would prefer the “simple” look than having all those banners/graphics, just like your site here.

    Regards,

    Robert

  3. Jim Says:

    Hi Suzanne,
    Thanks for the post. I tried this suggestion. I created a page and set that as my static page,and another page as my post page. I edited the page.php inserting the code you have here (using the theme editor), and nothing happens. Any suggestions? I love having the static text in my home page, but would really like a number of posts to display below them, so if I can get this to work, that would be fantastic.

  4. admin Says:

    Hi Jim,

    These are the steps that I used for this site, and they worked ok, but perhaps there is some sort of problem with copying and pasting the code from the blog.

    iIf you email me (click on the contact page link) I will send you the code in a text file and you can see if this works fine.

    Cheers,
    Suzanne

  5. Dave Says:

    Hi Suzanne,

    I’m having the same problem as Jim, would you be able to email me the code too?

    Many thanks

    Dave

  6. admin Says:

    Hi Dave,

    I emailed you the code.

    Cheers,
    Suzanne

  7. Jim Says:

    Hey Dave,
    Suzannes emailed me her code, and it works just fine, but actually so did the code pased right from the website. For me, it wasn’t the code. I had created my home page with a special template used in the theme. I had to paste the code in there, not the page.php. Good Luck.

    Thanks again Suzanne.

  8. Dave Says:

    Hi Jim,
    thats probably whats happening to me then, which page did you edit instead of the page.php?

    Thanks for the email suzanne, much appreciated.

    Dave

  9. Jim Says:

    Dave,
    What I did was actually take the code of the custom home page (index.php), inserted that code on the top of page.php, inserted Suzanne’s code into the appropriate place on that page, inserted this code on the top of all it:

    This will make a new template available for you to base your page creation on. I then used that template to create my home page, and made it static in the WP Settings.

  10. Grant Says:

    Hi, For some reason I can’t get my new wordpress installation to display a static front age. Have followed the above instructions but keep getting a “Error 404 – Not Found” displayed. I wonder if its because my permalink structure only displays postnames ie http://www.myblog.com/home and the home page is defaulting to only “www.myblog.com”

    Very frustrating!

  11. admin Says:

    Hi Grant,

    Sorry to hear you had a problem – it sounds like perhaps there is some more fundamental problem with your blog settings if you are getting a 404 error. You didn’t leave your blog URL, so I can’t take a look myself, but you may want to ask about it in a wordpress forum.

    Cheers,
    Suzanned

  12. Nat Colley Says:

    Could you explain exactly how this improves SEO?

  13. admin Says:

    Hi Nat,

    With blogging there are two different types of SEO:

    1) Optimizing your individual blog posts
    2) Optimizing your blog home page

    Having a static home page will help with (2). This is because if your blog is set up in the traditional way, with snippets of the latest posts, or the last 5 or so posts, the keywords on your page will be changing constantly, your main keywords are not likely to be in every post you make and so it may be more difficult to rank for your target home page keywords.

    I’m not saying that you can’t have an optimized blog home page wthout doing this, but is it just one way of making sure that your main keywords are prevelant in the first part of your home page.

    Cheers,
    Suzanne

  14. Mal Tindle Says:

    Hi Suzanne,

    Thank you so much for explaining this so well. Having just aquired a WP site I was wondering how to ad a static welcome page without it being affected by every post but is is easy now that you have explained it.

    I don’t know if you are planning any training on background and sidebar colour changes in the future as that is my next step for the ugly duckling LOL,

    thanks again,

    Mal.

  15. James T Says:

    Hi Suzanne

    Just a note to everone else. I had a parse error in my page.php code. I just changed the apostrophe to a quote:

    “showposts=5″. Now it works!

    Anyways, just to complicate matters, I would like my front page to be pretty spectacular. Therefore I want in this order:
    1. Description of the website
    2. Latest posts
    3. Google map embedded
    4. Another description/piece of text
    5. Another description/piece of text

    So the problem I have is that becuase the map and the bits of text are are incorporated in the one text box on the static editing page, the posts get displayed after, whereas I want the posts second.

    Can anyone help?

    Unfortunately I’m working offline through my server so I have nothing to show you

    James

  16. tina Says:

    Still trying to get the code to work. Think it because I have intalled a them in word press and I am not sure exactly what to leave in and what to delete after the code. And on another note- about the static home page. I based it on a page called it’s all about Theo, so now I have two pages that look exactly the same… I cannot deleted the page that the home page is based on since then it will have no reference. How did you work around this issue?

    tina

  17. Ali Says:

    Hey,

    I can’t get this to work :( When I paste the code, it just removes my sidebar and footer. Any suggestions?

    Thanks,

    Ali

  18. andy Says:

    hi Suzanne – thanks! this worked very nicely for me.
    I had a question: is there a simple line of code I can add that would pull in the first image I included within each blog post it is posting?

    I imagine something like
    <img src=”images/” />

    any ideas?

  19. admin Says:

    Hi Andy – glad you got it to work! Sorry I’m afraid I don’t know the answer to your question about the images. You may be better asking this on a WordPress forum.

    Cheers,
    Suzanne

  20. Steve Says:

    Hi Suzanne,

    Thanks for that, I’ve been looking for something that would do this for ages, and yours is the 1st I’ve found that I could get to work.

    The problem has always been that because the site has a totally hacked theme (doesn’t really have that Wordpress look) whenever I tried to put in a blog page it always removed the theme, or most of it’s settings.

    I added your code, or most of it to a seperate template file & everything works. What I can’t get to work is that if I leave the post titles as links, posts still don’t display on their own properly, but I don’t need that anyway. All I wanted was to be able to have a news/blog page that I could update regularly & display the last 5 or 10 posts.

    The page is working but not linked to in the site yet. Should be there in the next few days/weeks.

    Steve

  21. Pat EA Says:

    I have used WP themes that have this included in the past but I have always wanted to be able to use a static page on a theme without this built in. Now I can use a bunch of themes that I always wanted to.