• Within my archive.php, I have set up a query to exclude certain categories

    The archive function no longer works when I have this query set up, and it ends up displaying all of the posts that are not in the above categories, regardless of its post date.

    For example: if I were to access the archive from January, instead of showing only the posts from January, it displays all posts up until the most recent.

    <?php
    query_posts( 'showposts=5&cat=-3,-4,-5' );
    
    //required to display first post, else it ignores the first post
    rewind_posts(); 
    
    while ( have_posts() ) : the_post(); ?>
    
      <h1><?php the_title(); ?></h1>
      <?php the_excerpt(); ?>
    
    <?php endwhile;
    wp_reset_query(); ?>

    It works if I remove the query, but then it displays posts from the categories that I do not want displayed…

Viewing 12 replies - 1 through 12 (of 12 total)
Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Adding a post query makes monthly archive display all post’ is closed to new replies.