Problem Excluding Categories using query_posts on index.php
-
Hey Folks,
I have my front page setup as a static page which uses a custom page template. My blog is setup as a page in the WordPress admin and uses the default, index.php template. I am trying to prevent my photos from showing up on my blog. Photos are stored in the category with an id of 6. My attempt at using the query_posts function to modify the default loop is not working. Index.php code below:
<?php /** * The main template file. * * @package _s * @since _s 1.0 */ get_header(); ?> <?php global $query_string; // grab the global query information $posts = query_posts($query_string.'&cat=-6'); // exclude Photos category if ( have_posts() ) : ?> <div class="grid"> <div class="span12" role="navigation"> <?php _s_content_nav( 'navbar-top' ); ?> </div> <!-- .span12 --> </div> <!-- .grid --> <?php /* Start the Loop */ ?> <div class="grid" role="main"> <?php while ( have_posts() ) : the_post(); ?> <div class="span6"> <div class="module module-entry"> <?php /* Include the Post-Format-specific template for the content. * If you want to overload this in a child theme then include a file * called content-___.php (where ___ is the Post Format name) and that will be used instead. */ get_template_part( 'content', get_post_format() ); ?> </div> <!-- .module --> </div> <!-- .span6 --> <?php endwhile; ?> </div> <!-- .grid --> <div class="grid"> <div class="span12" role="navigation"> <?php _s_content_nav( 'navbar-bottom' ); ?> </div> </div> <?php else : ?> <div class="grid"> <div class="span12"> <?php get_template_part( 'no-results', 'index' ); ?> </div> <!-- .span12 --> </div> <!-- .grid --> <?php endif; wp_reset_query(); ?> <?php get_footer(); ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Problem Excluding Categories using query_posts on index.php’ is closed to new replies.