On my home page I have restricted the number of recent posts displayed using query_posts(‘posts_per_page=2’)
I would like to also exclude a category but can’t figure out how to integrate the two modifications to the loop.
Here’s my original code:
<?php query_posts('posts_per_page=2'); if (have_posts()) : while (have_posts()) : the_post();?>
<div class="date">Posted <?php the_time('F jS, Y') ?></div>
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<?php the_content('Continue Reading â'); ?>
<?php endwhile; endif; wp_reset_query();?>
I’ve tried following a few different tutorials but can’t get them to work. I’m sure this is my own lack of understanding, so any clear instructions or modifications to the code above will be greatly appreciated.
Thanks in advance!
Try the
cat=-#
syntax in your query:UPDATED to show how to manually handle it in your loop:
Please try this: