• Skip to primary navigation
  • Skip to main content
  • Skip to footer
  • Home
  • About
  • My Blogs
    • Photoblog
    • Knots
    • WP.com tips
kristarella.com

kristarella.com

Happiness Engineer at Automattic, lover of knitting, crochet, sci-fi and more

  • Presentations
  • Plugins
    • Exifography
  • Contact
You are here: Home / Blogging / Create a custom homepage in WordPress: the content

Create a custom homepage in WordPress: the content

8 May 2008 by kristarella

Contents
  1. Using WP editor
  2. Making a page template
  3. Customising a page template
    1. Remove the sidebar
    2. Remove navigation links
    3. Change the main content
    4. To show excerpts
    5. Show posts by category
    6. Add something attractive or useful
    7. Change the shape of the content
  4. Make the change

Last post I talked about how to create a custom home page in WordPress, but I didn’t mention many specifics of putting stuff on the homepage.

Now I will!

Using WP editor

I already mentioned that you can enter content into the page editor, just like a normal page. This will produce a static page: mostly unchanging. This is okay, but I get the impression that static portals are a thing of the past and dynamic pages are in. People won’t keep coming back to your site if it never changes. Sure, they might come to your posts page to see if there’s a new post… if they do, why did you make a home page to begin with?

A more interesting option is to make a page template, which can be updated with your latest posts, photos, whatever you like really.

Making a page template

I usually start by copying index.php from the current theme I’m using.

Once you’ve done that, name it something like homepage.php. It’s better not to use home.php because that filename is already used in WP themes. If your theme has a home.php page it will surpass index.php as the front page of your blog. You can use home.php for a homepage, but it will be more difficult to make a posts page that looks like the usual blog front page (well… I don’t know how to do it).

After copying index.php, and giving it a new name, insert
<?php
/*
Template Name: Homepage
*/
?>

at the very top of the file.

Customising a page template

Now you have a working page template, which when uploaded to your theme directory will show up in the Page Template dropdown box (on the page editing admin page).

The page will look the same as your front page already does until you change some things around.

Remove the sidebar

I don’t think sidebars are particularly useful on a home page because they usually relate to posts or blog-type things.

Remove <?php get_sidebar(); ?>.

Remove navigation links

The next/previous links for post pages and individual posts will become irrelevant on a single home page.

Remove <?php posts_nav_link(); ?> (or previous_post_link and next_post_link if they are used).

Change the main content

The section that generates posts will start with
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>

and end with
<?php endwhile; ?> and probably a bit later <?php endif; ?>.

These are the bits that you can delete or change to suit your home page needs.

To show excerpts

Change <?php the_content(); ?> to
<?php the_excerpt(); ?>.

Show posts by category

To show recent posts from certain categories, as I’ve done on the ASSSoc website, you can use code adapted from Chris Pearson.

<?php
// this is the where I put a description so I remember which category I'm using
query_posts('showposts=1&cat=8'); ?>
<?php while (have_posts()) : the_post(); ?>

the heading and content (or excerpt) code stays here
<?php endwhile; ?>.

You can show several posts by changing the number after showposts=.

Add something attractive or useful

Other things you could add include, links to resumes; links to photos or even photo thumbnails (using a Flickr plugin or a PixelPost plugin); a short profile; a list of your best or most popular posts.

Change the shape of the content

If you have removed the sidebar you might want to widen the content area (so that the header and footer don’t look funny). Don’t completely change the class or ID of the content div, you might lose all your other styles (paragraphs, headings etc). Just add another class.

For example, in the Copyblogger theme the post section is
<div class="post">.
It can be changed to
<div class="post homepage">
and then styled in the CSS using
.homepage { width:30em; } (or whatever size you want).

Make the change

To implement the page template, upload the file to your theme’s directory. Then go to the page you assigned as the home page and select the template from the Page Template dropdown box.

What else would you put on your home page?

Share this:

  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on X (Opens in new window) X
  • Click to share on Pocket (Opens in new window) Pocket

Like this:

Like Loading...

Related

Filed Under: Blogging, Tutorials, WordPress Tagged With: websites

Reader Interactions

Comments

  1. Robin says

    13 May 2008 at 14:57

    This is useful. Thanks.

  2. kristarella says

    13 May 2008 at 17:06

    Thanks Robin. You’re welcome 🙂

  3. Jeff says

    7 August 2008 at 16:40

    Awesome! This was really useful, thanks a ton.

  4. kristarella says

    7 August 2008 at 17:09

    You’re welcome Jeff. I’m very glad it was useful!

  5. Onyeka says

    26 December 2008 at 11:08

    This article just saved me a LOT of time! Thanks a lot.

  6. olisb says

    12 January 2009 at 22:50

    This is indeed a great article, thanks
    But I am a bit stuck with your last point ‘Change the shape of the content’
    I want to use totally different CSS for my custom template
    even posted about it here, but someone closed this unresolved topic 🙁
    http://wordpress.org/support/t.....?replies=4
    I’m really stuck, as the custom template I have created seems to ignore my custom.css file, despite being pointed at it. I think this is because the original style.css is still picked up in index.php (not sure how to tell it to not do this!?)
    Any more details about how to force a custom template to follow totally custom css and ignore all the original css would be most appreciated.
    Thanks
    Olisb

  7. kristarella says

    13 January 2009 at 11:33

    Hey Olisb,

    You can add a custom stylesheet to just that page template by adding the following to header.php.

    <?php if (is_page_template('custom.php') echo '<link rel="stylesheet" type="text/css" href="[url of your new stylesheet]" />'; ?>

    It uses a conditional statement that says “if this page uses the template custom.php, add the following text”.

  8. olisb says

    14 January 2009 at 05:07

    Thanks a billion Kristella, you’re ace 🙂

  9. Janet says

    24 February 2009 at 12:28

    thank you! I so want to use the thesis theme, but can’t for the life of me figure out how to customize it- this was very helpful!

  10. Kristian says

    26 February 2009 at 02:10

    This is a good tutorial. But what if I want to display the thumbnails of several pages, instead of posts? Is it possible?

    I want to create something similar to http://fatburgr.com/

    Thanks a bunch

  11. kristarella says

    26 February 2009 at 08:37

    Kristian, you would need to enter the content manually. You wouldn’t create a post loop like in this post, you would create a few divs and put the images and a paragraph of text in them.

  12. Dilip says

    14 May 2009 at 18:05

    And this is the other tutorial from you that helped a novice like me a LOT! Thanks for this too!

  13. ratiya says

    10 July 2009 at 16:30

    many thanks for a very useful information

  14. Jason Gegere says

    15 July 2009 at 17:30

    I would recommand reading the following blog post it helped me.

    http://www.vanseodesign.com/bl.....-dropdown/

  15. Jason says

    28 July 2009 at 02:16

    Thanks! So far, so good. Great Tip. 😀

  16. Jason says

    24 November 2009 at 00:52

    How do you do this part of the instruction?
    (and then styled in the CSS using
    .homepage { width:30em; } (or whatever size you want).)
    I am confused

    thanks in advance

  17. kristarella says

    24 November 2009 at 08:02

    Jason — In the instructions just before that bit I added a class of “homepage” to the div that contains the content of the post (in the homepage template) and then the bit that you are referring to goes in your theme’s CSS file to change the width of that section. Those instructions might vary slightly depending on your theme though.

  18. Net Success says

    8 February 2010 at 05:00

    I have just read both your posts, great information. I will keep trying to make my homepage a dynamic page!

  19. Daithí Ó hAnluain says

    14 February 2010 at 16:58

    Wow, Kristarella, this is exactly what I was looking for. I’ve been planning a blog for while, but I got bogged down for ages trying to get exactly the right template (yes, yes, I realise now: it’s the content, stupid!), but

    Thankfully, I’m a bit more focused on the important stuff now. Ironically I just started using the WordPress classic theme to play around with the css and just get used to wordpress.

    Ultimately, though, I want a landing page that would give people an overview of the site, with excerpts from a page explaining about the my topic (permaculture), the three most recent blog posts, some photos, a video, a word-of-the-day from the site glossary, a note about me, and maybe a feed from some other sites on sustainable human habitats.

    Elements, essentially, of all the different sections of the site. I figured it had to possible, but I had no clue how. I mentioned it to a web designer I used a couple of times and he just sucked in his teeth like a plumber planning his vacation. ‘Owwhh-yeAH! That’ll cost ya!’

    And now, voilá, you present the whole schmeer, just like that! Not only is it possible, not only can I do it myself without paying for my designer’s vacation, but the tut taught me a heap about wordpress design. Seriously, thanks a bunch!

    Sorry for the long comment, hope I’m not breaking protocol or anything.

  20. kristarella says

    15 February 2010 at 13:19

    Daithi — Glad it was so helpful for you! I also recommend taking a look at the WordPress codex on using multiple loops; since writing this post I’ve discovered using new WP_Query is a bit better than query_posts for new loops on the same page.

A triptych of baubles. These are very satisfying t A triptych of baubles. These are very satisfying to paint ❤️💚💙

#watercolor #watercolour #christmas
I have really enjoyed this Christmassy painting! S I have really enjoyed this Christmassy painting! So glad my friend asked me to make some cards for our church helpers, because it set me on a roll!
#watercolor #watercolour #christmas #christmascards #watercolorcards
Had a great Saturday at the GKR Karate State Title Had a great Saturday at the GKR Karate State Titles! I was a sub for @jamesxuereb.me in the Blue Flame Dragons thanks to his sprained ankle; we won first round and came fourth overall!
I did a bunch of judging and officiating, which was really good.
I didn’t place in my individual events, but had a very fun final round of kumite (sparring).

#gkrkarate #karate
More stamping tonight. Even better than last night More stamping tonight. Even better than last night’s!
Did some stamping this evening. Love it! I wish I’d done some pages in other ink colours before I dismantled the stamps 😂
Had an appointment in the city, so I got to visit Had an appointment in the city, so I got to visit the @legocertifiedstores_anz Wicked display!
#wicked #lego #afol #sydney
A little book I made from Bunnings paint sample ca A little book I made from Bunnings paint sample cards. It’s going to be for mini paintings and collages. Sometimes it’s nice to start with a colour rather than a blank white page!
A little while ago I did some swatching of Daniel A little while ago I did some swatching of Daniel Smith and Schminke Horodam watercolours. So soothing! I love some of the granulating colours!
#watercolours
Follow on Instagram

Footer

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Top Posts & Pages

  • Sistaco Nail Powder Review
    Sistaco Nail Powder Review
  • Home
    Home
  • Exifography
    Exifography
  • Kodak Retinette 1A: going retro
    Kodak Retinette 1A: going retro
  • bbPress Forum Icons
    bbPress Forum Icons
  • Cappuccino
    Cappuccino

Follow Me On…

  • Instagram
  • X
  • GitHub
  • LinkedIn
  • YouTube

Categories

Copyright © 2025 · Kristen Symonds · kristarella.com

%d