WordPress is, well, the cats pajamas. For your interesting factoid of the day, cats pajamas was used by hipsters in the 1920s to refer to a person who was the best at what they do. I really can’t heave enough accolades on the platform, or its open source community. Though WordPress is painfully easy to use and a breeze to build a professional, robust website, there are times when you need to make small tweaks to the formula to fit your specific needs. Most WordPress themes fall under this category. They look fabulous populated with all that sample data, yet when you pull them out of the box and begin to play with them, you find certain features just don’t work for your site. The home page is a prime example. Let’s break down a few customizations you can make to your WordPress theme to make it patently you.
> Display a Single Post on WordPress Home Page
If you wanted to set your home page as a static page you’ve created, this is a really simple process. Within your WordPress admin screen, go to Settings > Reading. Under the Front page displays block, select the static page radio button then choose the page from the drop down list that you want to display. Click that save changes button at the bottom and go to the site to checkout all that taxing work you did.
If you are jonsing to set up a WordPress post as your static home page, this is slightly more complicated since you’ll be forking into some php code. First identify the ID of the post you want to set as the home page. You can either pull this from the post url, or if you have custom permalinks, simply hover your mouse over the post title in the main posts screen and look for a post=xxx value. With the post ID in hand, go to Appearance > Editor > index.php (with some themes, you’ll have to navigate to this file via FTP). As with any changes to core template files, I strongly suggest you make a backup of these files before making any code changes. It can be as simple as copy and paste into a text file. Once inside the index.php file, you’ll need to find the while loop that cycles through the posts (starting with ‘while (have_posts()’). Just before that, you’ll set the query_posts method equal to the id of your post. It would end up looking something like this:
query_posts(‘p=40′); while (have_posts()): the_post();
> Display Only Certain Categories on WordPress Home Page
Maybe you don’t want every category you post on your site emblazoned on the home page. Maybe you have posts that are very relevant to certain users, but not everyone else doesn’t need to be bothered with that content. An example of this would be if you had a site that did concert news and reviews that also featured live setlists. Most people would be interested in reading up on the latest the news and reviews, but the setlist posts would be more for the die hard fans.
First, we’d need to identify the categories that we wanted to feature on the home page. In the WordPress admin panel, if you go to Posts > Categories you can pinpoint the categories that want to feature. Simply hover over the category name to spot the value of the tad_ID. If we wanted to trim our posts so only these categories showed up, we’d access that main index template again (Appearance > Editor > index.php). The key here is we need to define the category IDs within the query_posts method (cat=3,57). This could be one category ID or a long string of numbers. We also add the showposts and paged values to tell WordPress to display posts 10 at a time (or whatever number your little heart desires) and paged to determine what page of results the user is on. The full implementation of this, including its relative placement within the existing code, is listed here.