WordPress Custom Home Page Design – Widgetized Front Page


So you’ve managed to specify a custom front page in your WordPress setup by going to: [settings], [reading], [front page displays], ["A static page" - Radio Button]. What now? Who cares if you can create a custom front page with static content on it. We want some cool, more advanced, wigetized goodies to pull together our blog on a dynamic basis. If you’ve seen the new front page of RobMalon.Com then you’ll have an idea of some of the functions I’m about to teach you so that you can setup something similar on your blog.

Custom Home Page Design & Layout

An important first step to this is drafting out what you want to do. Organize what widgets are going to go where. That’s difficult if you don’t know what WordPress is capable of. So, to briefly go over what we have at our hands, plan out your front page content based on these questions:

  • What categories if any are important enough to to give them their own mini feed on the front page?
  • How many recent articles in each widget do you want to display? Offsetting this in various places will allow you to tweak a homepage to get it to balance nicely where it otherwise wouldn’t because of uneven content in columns.
  • Do you want to display the first 200 characters (without links/images) of each article? Consider how this will effect the previous point I made.
  • Design and architecture. – See the layout idea to the right for a visual example. In spot one in the left side example you might put the 8 most recent articles across the entire site and include all categories. In spot two you might have posts only from a category which you’ve labeled “Updates”? Or perhaps a category which you use to tag your latest “Video” posts? Then in category 3 a list of articles which you consider to be “Featured” articles. The list is endless with options. When you go to setup your page like this, a lot is determined on how well you categorize your current posts. For example, I implemented a featured area in the top tabbed area on the front page. I had to go back, create a new category, and apply that category to existing posts as I saw fit. Then, from now on, I simply add it as I go when I write a post that I want to show up in the “featured” widget on the front page.
  • While you’re planning out your widgets, don’t forget, you can use code from other plugins as well. More about that in a bit.
  • For more setup/planning tips check out WordPress Theme Customization & Design – Creating Sidebars.

Table Or CSS Setup

Now that you have that down, its time to implement some layout code. If you’re new to this, set this up in a table. If you’re looking to go all hardcore, then use a layout with div’s like this:

  1. //Setup For Example 1 (3 widgets)
  3. <div style="width:100%; padding: 5px; border: 1px solid #FFFFFF;">
  5. </div>
  7. <div style="clear:both; padding-top:5px;"></div>
  9. <div style="float:left; width:200px; padding:5px; border:1px solid #FFFFFF;">
  11. </div>
  13. <div style="float:right; width:200px; padding:5px; border:1px solid #FFFFFF;">
  15. </div>
  18. //Setup For Example 2 (4 widgets)
  20. <div style="float:left; width:200px; padding:5px; border:1px solid #FFFFFF;">
  22. </div>
  24. <div style="float:right; width:200px; padding:5px; border:1px solid #FFFFFF;">
  26. </div>
  28. <div style="clear:both; padding-top:5px;"></div>
  30. <div style="float:left; width:200px; padding:5px; border:1px solid #FFFFFF;">
  32. </div>
  34. <div style="float:right; width:200px; padding:5px; border:1px solid #FFFFFF;">
  36. </div>

In case you’re confused, all this code is going to go into a “page” which you should have already specified as the homepage. If not, its not a bad idea to practice on a non-frontpage which is unpublished so you can experiment without putting an existing blog into chaos.

Coding The Widgets

Then you have some options for each widget. What you need to do is tell the proper WordPress function to loop through the posts that you’d like to display. Here are the examples:

  1. <?php
  2. //Setting up the new loop of posts
  3. global $post;
  4. //Getting Posts - More on this below
  5. $gettingposts = get_posts('numberposts=5&category=1');
  6. //Starting the loop
  7. foreach($gettingposts as $post) :
  8. setup_postdata($post);
  9. //Below is a custome output of a link setup
  10. ?>
  11. - <a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to &ldquo;<?php the_title(); ?>&rdquo;"><?php the_title(); ?></a>
  12. <div class="postbreak">
  13. <?php
  14. //End the loop
  15. endforeach;
  16. ?>
  18. <?php
  19. //This bit of code will loop through 5 recent articles covering all categories and post the_excerpt() - A 200 character clip from the post that excludes any html in from those first lines.
  20. global $post;
  21. //Getting Posts - More on this below
  22. $gettingposts = get_posts('numberposts=5');
  23. //Starting the loop
  24. foreach($gettingposts as $post) :
  25. setup_postdata($post);
  26. //Below is a custome output of a link setup
  27. ?>
  28. <h3><a  style="font-size:14px;" href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
  29. <?php
  30. //Display a clip from the post
  31. the_excerpt();
  32. //End the loop
  33. endforeach;
  34. ?>

Creation of intricate homepages can be further enhanced by using multiple wordpress template tags. All the documentation is there, simply call the functions with the parameters you want (as available in each template tag). In the example above I first show a way to iterate through links in a particular category using the template tag get_posts. In the second example I use it again but this time don’t specify a category (so it displays all recent posts) and show the_excerpt() with it which takes a clipping of the current post in the_loop.

Look through the get_post documentation and append the proper variables to adjust the output you’d like to see. Fro example, the following get_post function will display 3 posts from all categories except 5 and 8:

If you want to find the ID of a category, post, or page do the followign:

  • log into admin.
  • Navigate to the manage tab.
  • Click categories (or posts or pages)
  • Hover over or click on the proper category, post, or page you wish to know the ID of
  • In the status bar (if you’re hovering) or in the Address Bar (if you clicked) you should see a link that looks similar to this:

  • In the above example I was in categories. The category I chose has an idea of “11″. Now I can exlicitly include or exclude it. In some cases you’ll want to do this with posts and/or pages as well. get_posts doesnt support this, but if you play with other WordPress functions, they sometimes do. Check the template tag documentation on a per function basis. You’ll at least know how to get the ID’s now without having to log into your mySQL database.


You may need a plug-in called Exec-PHP installed on your blog so that you can execute the above PHP code inside posts. Be careful about installing this plug-in if you have other people managing your blog with you though. If so you can setup custom privileges. If not then just make sure its installed and activated.

I’m sure you’ve seen countless other plugin’s out there which provide you with a snippet of code which you can use in your sidebar.php file inside your theme folder. You can also use that code within any of the widgets you create on your homepage within those blocks. You can usually find code like that inside the readme or install notes file that most plug-in come with.


On the left is an example of my front page from when I recently redesigned RobMalon.Com. I also recently helped a personal friend of mine create a similar setup with his page at ToddRecommends.TV who does Live streams and talks Movies and Tech. You can see a clip of what his front page currently looks like on the right-hand side. He has his recent posts for each of his main categories on his page and is displaying a feed on the top right from another category which he uses for updates about events, updates, and general news.

Wigits VIA Sidebars

To create a WordPress site with the most amount of flexability, you might choose to impliment this code as part of a custom Sidebar setup. Which I’ve explained fully here: HTML clipboard WordPress Theme Customization & Design – Creating Sidebars.

Respond: Leave A Comment | Trackback URL

Entrupeners, Subscribe for the lastest tools, tips, and tutorials.

3 Responses to WordPress Custom Home Page Design – Widgetized Front Page

  1. Thanks for the plug man, and the tips! I might try adding some more functions to my home page!

  2. Pingback: Wordpress Wednesdays: Widgetized Front Page |

  3. Hi Rob,

    Compliments of the seasons. I wish you and your blogs greater heights this New Year.

    Can you please help out with a challenge?

    I recently started blogging using wordpress but I don’t know how to properly upload pics.

    When I upload and preview it to be sure before publishing, I only see the post. The picture doesn’t show on the preview.

    I am counting on your expert help as always.

Leave a Reply

Custom Theme by Rob Malon | Content & Design © 2010 - RobMalon.Com - Chicago, Illinois