I want to create a loop that excludes a category and only displays a certain number of posts per page.
I have tried both have_posts and query_posts to do this, but I'm a bit stuck on the most effective method. What would you use to do this?
Just use a custom query like this:
$exclude_cats = '2,52,3';
$posts_per_page = '4';
$loop = new WP_Query("category__not_in=$exclude_cats&posts_per_page=$posts_per_page");
if($loop->have_posts()):
while($loop->have_posts()): $loop->the_post();
//Do stuff here the_content(), the_title() etc...
endwhile;
else:
//Do something here
endif;