How to create a custom homepage in WordPress
The issue of using a portal-style home page in WordPress has come up a couple of times recently. I’ve tried to help some people with the code and settings. I’ve learnt a fair bit in the process that I thought was worth sharing.
WordPress can use a file called home.php as a homepage, which supercedes index.php. Allowing you to show whatever you like on your homepage. Now, WordPress v2.5 gives you the option of using a “page” as the home page of your blog/website. I like this method much better, because it allows a home page and the regular blog/posts page.

To do this you need to
- Create your home page
- Create a posts page
- Change the Reading settings
Custom Permalinks
On a slight tangent. I highly recommend that you enable custom permalinks. Doing so will allow for sensible page addresses. For example the ‘about’ page will be at www.example.com/about/ instead of www.example.com/?p=2 (or something like that). Later, when you create the posts page, it can be at www.example.com/blog/ or /posts/ or /articles/.
There’s a pretty good explanation for changing the permalink structure at Blog Tutorials.
Create a home page
Presumably you are familiar with writing posts and pages — your site would be pretty skint without them!
The first step of creating a home page is no different from any other page. Go to Write > Page.
Give the page a suitable title, such as Homepage or Home and save the page. By default the title of the page will become the post-slug or permalink name; i.e. a page called Homepage will be found at www.example.com/homepage/. In WordPress v2.5 you can edit the permalink under the Title.
Home page content
Adding the home page content can be as easy as writing a post — if you want static (unchanging) content. This kind of page will be displayed with the standard page template, which usually looks the same as a post page (header, content, sidebar, footer).
The other option is to create a Page Template, which is a little more involved. I’ll cover a bit about this in a later post.
Once you have the content you want on the page, be sure to Publish it. You might be able to see a saved (but not published) page when you’re signed in, but others won’t.
Create a posts page
All you need to do for a posts page is Write > Page, give it a title such as Posts or Blog (whatever you want the address to be). Publish the page.
When you apply this page as the posts page it will use index.php to show the posts.
Change the settings
To activate these pages go to Settings > Reading, choose “Front page displays a static page”. Then select the pages from the two dropdown boxes.
Voila! Separate home and posts pages.
Do you have any questions? Do you want to put something on your home page, but don’t know how? Leave a comment and I’ll try to cover it in the next post.
Bookmark this post: Del.icio.us · Digg · StumbleUpon ·


24 brushes for GIMP and Photoshop
Personalising the Copyblogger Theme
Mum's Story
8 comments
sotolicious
Wednesday, May 7
21:09 GMT+10
great post!
But an FYI to pre-2.5 users, the static page as your home page is a standard feature that goes back a while and was made an admin option in version 2.1.
kristarella
Wednesday, May 7
22:25 GMT+10
Thanks Jay (sotolicious)!
Yep, I suspected the static page feature had been there before, but I’d never used it. I figured I’d say 2.5 to be on the safe side. Thanks for the heads-up.
Also, if people are still using old versions I’d recommend upgrading. I’ve read stuff about security issues, but mainly the interface is way better and there are some handy features too.
sotolicious
Wednesday, May 7
22:45 GMT+10
NP - 2.5 is definitely worth the time and effort to upgrade to - and it’s not as involved a process as one might think.
2.5 is a nicely refined application I actually look forward to using every time I log in. I’ve developed and manage a dozen other sites, most of which use Joomla (which is a nightmare in and of itself but still better than pre WP2.5)… now I’m re-thinking future site development using the 2.5 platform for non-bloggish like design as it’s the refinements to features like the one you point out that make WP a serious CMS contender.
kristarella
Wednesday, May 7
23:20 GMT+10
Have you upgraded to Joomla 1.5? The interface makes so much more sense than the 1.0 series. Unfortunately the changes were so significant I think the themes are incompatible.
I don’t use it, but I was tempted to build a site on it, until I realised that I could do it on WP and it would be much simpler to pass on to the next person who’ll run it.
I agree, WP is getting up there in functionality and versatility.
Robin
Tuesday, May 13
14:55 GMT+10
Hi Kristarella. Please let me add some more.
By choosing new ‘Home’ page as homepage, in many themes, original ‘Home’ link will likely redundant (or doubled and the new slug will be /home-2. At times confusing).
If it happens then simply find and delete this line in header.php file or something alike:
<a href=”/”>Home </a>
Hope it helps.
Robin
Tuesday, May 13
15:01 GMT+10
Oh the codes disappear
kristarella
Tuesday, May 13
17:07 GMT+10
Hey Robin,
Thanks for the input! Yes, you’re right - once the page becomes the homepage it’s address will just be the root of your blog. I didn’t really think of that
I guess it’s useful to know the address of the page before you activate it as the homepage, you can make sure the page looks right.
Was there another page located at /home that you were referring to as well?
Fixed up that code - you did the right thing with the first part, but the last part was parsed (?) as html.
Trackbacks
Leave a comment