View Full Version : Displaying Post with a certain category on the home page

11-25-2009, 03:14 AM
I have a number of posts marked under certain categories - I would like to only display those posts with a certain category(s) on the home page ..... how do I do this. At the moment SWIFT displays all - which isn't quite what I need.


11-25-2009, 10:15 PM
add this line

<?php query_posts($query_string . '&cat=5,6,7'); ?>


if (have_posts()) : while (have_posts()) : the_post();

In layouts/blog.php and layouts/magzine.php

Replace 5,6,7 with the id's of categories you want to display.

11-25-2009, 10:45 PM
there's also a really good plugin called Simply Exclude if you don't want to mess about with code, or want it to be a temporary thing.

I use it, highly recommended and works perfectly with Swift

12-21-2009, 06:40 AM
I can't get any of my posts to appear in the Home Page magzine section. It's completely blank.

How do I assign what categories get listed there...I would actually prefer just to have the most recent ones (perhaps 10) listed.

What I'm referring to: http://www.billfallwell.com



03-27-2010, 07:59 AM
How about if I want to display posts of a certain category only on 1 page, but not the homepage? Is there a PHP snippet I can put in the body of a page maybe?