Exclude a category from the loop
Sorry, this is a follow up to an earlier related post, but I want to exclude a category from the loop. I’ve seen related posts and know what I have to do (I just don’t know the exact syntax, but basically I know I need to add this:
<?php query_posts(cat=’-4′); ?>
<?php $page = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("showposts=4&paged=$page"); ?> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part('content','archive'); ?> <?php endwhile; ?>
…except I don’t know exactly, precisely, how to phrase the code. If you could show me exactly how to include it that would be great, but (even better) recommend a GREAT SOURCE for learning to write WP’s propietary .php code.
- The topic ‘Exclude a category from the loop’ is closed to new replies.