I'm trying to exclude several post categories from the loop on a page template file. I've been to http://codex.wordpress.org/The_Loop and followed the pretty simple instructions, but the following code is still including posts from the 'excluded' categories.
<?php query_posts('cat=-6,-11,-12,-13,-14,-15,-16&posts_per_page=8'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
I've also tried it this way...
<?php query_posts($query_string . '&cat=-6,-11,-12,-13,-14,-15,-16'); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
...but that still doesn't exclude those categories.
The only thing I can think of is that the above code is correct, but I have the category id's wrong. Here is a category link I obtained by hovering over the category from within the Admin Panel's Category page...
http://mywebsite.com/wordpress/wp-admin/edit-tags.php?action=edit&taxonomy=category&tag_ID=11&post_type=post
So why does the above code not exclude category 11?
Entire page.php code follows:
<?php
/**
* @package WordPress
* @subpackage Default_Theme
*/
get_header(); ?>
<?php query_posts('cat=-6,-11,-12,-13,-14,-15,-16&posts_per_page=8'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
<?php if(is_page('news')) {?>
<div class="entry">
<p class="postmetadata">
<?php _e('Filed under:'); ?>
<?php the_category(' , ') ?>
<?php _e(' | '); ?>
<?php the_time('j F, Y'); ?>
<?php _e('by'); ?>
<?php the_author();?>
<?php edit_post_link('Edit', ' | ', ''); ?>
<?php
global $more;
$more = 0;
?>
<!--The $more variable above must be inserted ahead of the call to the content-->
<?php the_content('Read more...'); ?>
<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
</div>
<?php } else { ?> <!-- if it is NOT the news page -->
<div class="entry">
<?php the_content(); ?>
<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
</div>
<?php }?>
</div><!-- end div class post -->
<?php endwhile; endif; ?>
<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
<div class="clear"></div>
<?php get_footer(); ?>