To have a unique WordPress blog home page you don’t have to create your own theme. I’ll show you 12 ways to hack your homepage without getting a new theme that will make your blog stand out from the pack!

This is installment #14 of 30 WordPress Hacks in 30 Days, be sure to sign up to our RSS feed or email updates at top right of this page!W

Everyone wants their blog to be different. You want it to be unique, to stand out, while remain easy to present what it is your blog is about. The same old “rolling list of posts” and obigatory sidebar can get (real) old after awhile. Out of the box, everybody’s WordPress blog looks the same, and getting a custom theme is the first stab at breaking out of that box. The next step (before creating your own theme from scratch) is hacking that theme up a bit to get more of what you want out of it. While some of the techniques I’m about to show you can be used on nearly any page in your WordPress blog, the focus of this article is “ways you can hack your WordPress home page!

*All the plugins mentioned on this page are listed on the WordPress 2.5 Compatibility list*

1. Organize posts in 2 Side by Side Columns: Maybe you are tired of that one-column of content on your homepage, and you want more of a magazine or newspaper layout approach. If so, breaking up your posts into 2 side by side columns of content could be good for you. I can’t take credit for this hack, it’s well explained, including where to put the code and which files to edit – over on the Crea8 Design Blog: Side by Side WordPress Columns.

2. Create Custom Comment Counts: Here’s a hack that I desperately tried to figure out for months and months, and never really found the answer to all in one place. I ended up finding the answer not in a blog post, but in theme code instead. Some of the best bloggers sites that I read have some post meta-information in the title header, including a comment count. Usually it’s also a link, and sometimes it has a cool little comment bubble or a phrase like “What do you have to say?”

Normally to just get a “comment count”, you see code like this in a theme:





After “comments_popup_link” the text inside the three sets of quotes represents what should be printed out if there are no comments yet, only one comment, or more than one comment. You modify the text to say whatever you want here. You could change ‘No Comments’ to ‘Be the first to comment…’, etc. But, if you’re like me you probably want to spice it up a bit and add a nice little comment icon. If so, use this code:



';
comments_popup_link($comments_img_link .' Comments(0)', $comments_img_link .' Comments(1)', $comments_img_link . '  Comments(%)');?>

In the first line just change the path your theme image directory and copy and past the code wherever you want the comment count and icon to appear for your home page posts.

Unique Ads Between Posts: This technique can be used to place most anything in between the posts in “the loop” on your home page, I used it to display adsense ads after the 2nd and 6th posts (in the loop of 10). It doesn’t have to be an ad – it could be used to show image dividers between each post, random quotes, special links – anything.

First – I’ll show (again) what “the loop” basically looks like:






				

“The Loop” in WordPress is a function that retrieves from your database a series of (10) posts. It starts out with the “have_posts” line and ends with the “endwhile” line. It’s called the loop because it does the same thing over and over – one post at a time. That’s why inside “the loop” is the code to print the time, category, comment count, and whatever miscellaneous things are in your themes loop. You loop might be slightly different than my example for just that reason, different details are displayed for posts in different themes. That’s the beauty of being able to “hack wordpress” – you can easily change those details.

What we’re going to do is insert a “counter” in the loop, and then tell it to do something when it reaches certain numbers in the count. Here’s the modified code to do that:







				

You’ll notice in this modified example that on the second line we have inserted a counter that starts with “1” the first time through. The second to the last line (count + 1) ads one number to the counter each time through so it can keep track of which post we’re on. The two lines before that say “if the counter is on #2 or #6 – include this file”. I created 2 files, both advert1.php and advert2.php and placed them in my theme directory. When the counter reaches 2 or 6 it opens those files and prints the contents to the page. For my home page, both those files contain the adsense code to be displayed in those spots. As I said – you could include anything, and you can name those file whatever you want. In addition, you can change, modify, or add lines to the counter for any number 1-10 as well.

3. Dump the Next and Previous: I’ve always hated those “previous posts” link on the bottom of every WordPress homepage. I want my visitor’s (especially the first time ones) to know that I have many pages of content they can peruse, and a numbered list (like navigation at google) tells them just that. They can easily jump back to page 3, or 6, or whatever to view previous posts, and then back again. WordPress’ pagination feature of only one page at a time is terrible at best. The WP Page Numbers WordPress plugin takes care of this seamlessly. *Note, this plugin can also be used all other templated pages where more than one page of posts are retrieved.

4. Homepage Excerpts: If you want to control how many posts on your home page are displayed full and how many to show as excerpts (without mucking in any code at all), Homepage Excerpts is the plugin you need. I use this on most of my WordPress sites, and you basically configure it with 1 click (how many posts to display full).

5. Enable Post Voting: You could enable a voting function by using Vote It Up enabling your WordPress readers to vote for your posts Digg or Reddit style, and then put a list of most popular ones at the top of your homepage like this:

vote it up wordpress example

6. Random Featured Post: Use your old posts and give them new life, by creating featuring a random post before your content on your home page using the Random Featured Post WordPress Plugin. You might also try Advanced Random Post.

7. Display an Accouncement: Using the Genki Announcement plugin you can display an announcement before your posts on the homepage. This is great, because you don’t have to hack any code to do this, you can turn the message on or off whenever you want, and you can even restrict it to differerent roles or users if you need to. There’s even a timer feature to turn the announcement on or off. Your message could be holiday related (Merry Christmas!), or a time advertisement (for 48 hour only), a message (to all site admins), or everyone (thanks for visiting my blog!).

8. Make a Post “Sticky”: Instead of an announcement or a random post, maybe what you want to do is make one particular post “sticky” – or have it stay at the top of the homepage (until you change it). Easy enough, Lester Chan’s Creating a Dynamic Sticky“. Basically he figured out how to create “two loops” on the homepage. The first loop gets one post from one category. Basically he created a new category called “frontpage” and assigned all the articles he wanted to “feature” for a time. Then the first loop shows one featured article at a time in a styled div box. Then, immediately following the normal loop gets the 10 latest posts from the database, but it does check to ensure that it doesn’t duplicate the featured post again. Very nice hack!

10. Edit Article Excerpts: WordPress Excerpt Editor is a unique plugin that allows you to add custom excerpts for page (something you can’t do without a plugin). Normally, if you choose to use excerpts – WordPress will take the first so many words of your posts. As far as your homepage is concerned, this doesn’t do much for “original content” or avoiding “duplicate content” at all. This plugin enables you write a custom excerpt for each post or page, as you write it. Then, if you use excerpts on your homepage – the custom excerpt will be dispayed instead of the first “x” words making your home page contain completely unique content. It also allows you to write some different linkbait enticing people to click and view that article. It has options to do the same for both archive and tag pages.

Excerpt Editor also has some advanced options for showing excerpts of “x” recent posts under each Post/Page and it can even show excerpts from “x sub pages” on each page. With all these options, it can do many things beyond custom excerpts on your home page.

11. Add Thumbnails to Your Posts Using Custom Fields: There are many, many ways to add images to posts either manually or with a plugin. Once of the most overlooked features of WordPress is the “custom field”. You have the ability to create and fill-in custom fields with every post you write, but probably don’t know it. Under every “write post” page is the “custom fields” form (this one from WP 2.5):

custom field example

A custom field is nothing more than metadata that you create. You probably know metadata as keywords and descriptions for search engines, but you can make your own custom metadata fields to describe or enhance your posts. Each custom field has a “key” and then a “value”. The key is the name of the metadata (like Image or thumbnail) and the value is the content (like file.gif or picture.jpg). Just Tadlock has a pretty good Introduction to Custom Fields, and also Custom Fields: Adding Images to Posts.

12. Create a Date Button for Posts: Seems like most of the more “premium” WordPress themes (and hand-crafted ones) have a “date button” for the post, a nice image with the month abbreviation and the date (sometimes the day of the week too). Small Potato at WP-Designer wrote a great tutorial last year on How to Create a Date Button.

I hope these home page hacks helped you, and as always if you have something to add to make this post better (or a question) – please comment now!