Opened 15 years ago
Closed 15 years ago
#8798 closed defect (bug) (invalid)
query_posts pulls all post categories instead of category specified.
Reported by: | cynthea | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.7 |
Component: | Template | Keywords: | |
Focuses: | Cc: |
Description
I recently upgraded to 2.7 and believe query_posts tries to pull all published posts instead of the category I have specified.
Here is the code I was using:
?php /* Template Name: Books */ ?> <?php get_header(); ?> <div id="content_box"> <?php include (TEMPLATEPATH . '/l_sidebar.php'); ?> <div id="content" class="pages"> <h2><?php the_title(); ?></h2> <div class="entry"> <h3>2009 Winter</h3> <?php query_posts('cat=55'.'&order=ASC'); ?> <?php while (have_posts()) : the_post(); ?> <ul> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a> </ul> <?php endwhile;?> <h3>2009 Spring</h3> <?php query_posts('cat=7'.'&order=ASC'); ?> <?php while (have_posts()) : the_post(); ?> <ul> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a> </ul> <?php endwhile;?> <h3>2009 Summer</h3> <?php query_posts('cat=7'.'&order=ASC'); ?> <?php while (have_posts()) : the_post(); ?> <ul> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a> </ul> <?php endwhile;?> <h3>2009 Fall</h3> <?php query_posts('cat=9'.'&order=ASC'); ?> <?php while (have_posts()) : the_post(); ?> <ul> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a> </ul> <?php endwhile;?> <h3>2010 Winter</h3> <?php query_posts('cat=59'.'&order=ASC'); ?> <?php while (have_posts()) : the_post(); ?> <ul> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a> </ul> <?php endwhile;?> <h3>2010 Spring</h3> <?php query_posts('cat=56'.'&order=ASC'); ?> <?php while (have_posts()) : the_post(); ?> <ul> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a> </ul> <?php endwhile;?> <h3>2010 Summer</h3> <?php query_posts('cat=57'.'&order=ASC'); ?> <?php while (have_posts()) : the_post(); ?> <ul> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a> </ul> <?php endwhile;?> <h3>2010 Fall</h3> <?php query_posts('cat=58'.'&order=ASC'); ?> <?php while (have_posts()) : the_post(); ?> <ul> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a> </ul> <?php endwhile;?> </div> <div class="clear rule"></div> <div class="clear"></div> </div> <?php include (TEMPLATEPATH . '/r_sidebar.php'); ?> </div> <?php get_footer(); ?>
This page can be viewed here: http://www.authorsnow.com/books. As you can see it is displaying everything under the sun, instead of the posts in the specified categories.
This page used to work when I was on WP 2.6.3
Change History (4)
Note: See
TracTickets for help on using
tickets.
Are you sure that you have the category IDs correct? The exact code works fine for me with my corresponding categories, but I notice when I try appending
?cat=7
or other ID numbers to your site, which should redirect to those categories, it doesn't redirect.That says to me that something else is going on here; perhaps you have the wrong numbers or a plugin is interfering.