Support » Fixing WordPress » Simple query_posts not working

  • Hi There, can anyone help me understand as to why this isn’t working? It seems simple enough and is what the codex suggests but it has no affect on what categories show – Much appreciated

    <?php query_posts($query_string . "&cat=-1"); ?>
    			<?php if ( have_posts() ) : ?>
    				<?php while ( have_posts() ) : the_post(); ?>
    					<?php
    						get_template_part( 'content', get_post_format() );
    					?>
    
    				<?php endwhile; ?>
    
    				<?php matt_content_nav( 'nav-below' ); ?>
    
    			<?php else : ?>
    				<?php get_template_part( 'no-results', 'index' ); ?>
    			<?php endif; ?>
Viewing 1 replies (of 1 total)
  • Are you sure that your code is being executed? If so, try declaring $query_string as a global:

    <?php global $query_string;
     query_posts($query_string . "&cat=-1"); ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Simple query_posts not working’ is closed to new replies.