How to Configure the Home Page

September 15, 2007

I thought it would be helpful to write up a tutorial on the basic structure/elements of any of our Gambling Theme homepage. Just about every aspect of the home page is dynamic, with a few small exceptions, so once you understand how things are pulled, it’s very easy to customize it to your needs.

Header
The blog title is dynamic, and does not use an image – as the original Revolution theme does. This means that upon download and activation of the theme, your title will automatically show in the upper left hand section of the site.

As for the main navigation, the blue navigation bar is coded to display a list of pages and the gray navigation bar is coded to display a list of categories. These can easily be changed, or with the help of the WordPress codex, can be re-configured to display differently.

Content Area
The left and middle columns of the homepage are configured to pull categories, which makes it very easy to change and customize. I figured that this was the best approach since most newspapers operate with the concept of “sections” like my demo site does.

There’s really only one piece of code that dictates what is shown on the homepage – what you will want to do is open the home.php file, and identify the various containers that are displayed on the home page. The piece of code that will become your best friend is this:

<?php $recent = new WP_Query("cat=10&showposts=10"); while($recent->have_posts()) : $recent->the_post();?>

The cat=10 piece of code is where you can select which category to show in each area – just replace 10 with the category ID that you want to display. This is how you can display the latest post of different categories down the middle column.

The showposts=10 piece of code is where you can select how many posts of that category you want to display. If you want to display 5 posts from category 3, then your code would look like (“cat=3&showposts=5”).

Comments

Got something to say?