Menu :   Home | Blogging | Categories | | Gallery About | Chat

If you check out my theme, you would notice that only the first latest post of my blog is expanded and showed and the rest of the post follows with summary. Some people would just love to have this kind of theme as it’s more clean when viewed. Here is the hack on how i did it. It’s not the cleanest code and im pretty sure there are better ways to do it, but it just works. Editing should be done to index.php file.

Basically the concept is to create multiple loop with post limitations and offset. Open up index.php and follow this code. The code below is used to display only the 1st post of your blog and it’s up to you to design it.


After the code we follow up with another loop where you can specify how the remaining posts are displayed. You can display the title and also the excerpt like how i have displayed on my site.

From the above code, we can simply change a few variables.

In the code above you could change the ‘showpost’ section to the number of remaining post you want to show on the frontpage and the ‘offset’ is used to skip how many posts before displaying the list of posts.

If you are having problem to display your posts inside category or if you use index.php as your category template, then adding this code in index.php might help.

Basically that is about it. You may adopt this code into your theme and it should work fine, i tested it on WordPress 2.1x without problem. Please take note that this code might not work with all themes and also might cause conflict with some themes and plugins.

Posted at 12:58 am on December 25th, 2007 in Tips & Tricks with 4,057 views



Related Posts:





[ made & maintained by ramesh | get me on about.me/meshra ]