Title: Category shows wrong posts
Last modified: August 20, 2016

---

# Category shows wrong posts

 *  Resolved [grezliq](https://wordpress.org/support/users/grezliq/)
 * (@grezliq)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/category-shows-wrong-posts/)
 * Hello
 * I have a problem.
 * I have one, basic category – it’s blog.
    I added the second one – news.
 * And.. on my site, when I’m opening category “news” it shows posts from blog.
   
   I don’t know what is wrong.

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/category-shows-wrong-posts/#post-3500164)
 * what theme are you using?
 * does the theme have a _category.php _or, if not, an _archive.php_?
 * what is the code in those templates?
 *  Thread Starter [grezliq](https://wordpress.org/support/users/grezliq/)
 * (@grezliq)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/category-shows-wrong-posts/#post-3500169)
 * category :
 *     ```
       <?php
       /**
        * The template for displaying Category Archive pages.
        *
        * @package WordPress
        * @subpackage Twenty_Ten
        * @since Twenty Ten 1.0
        */
   
       get_header(); ?>
       <div class="page_img">
       	<?php
   
       	 if ( has_post_thumbnail(6))
       	 {
       		$image = get_the_post_thumbnail( 6 , 'page_photo' );
       	 	echo $image;
       	 }
       	 ?>
   
       </div>
       		<div class="page_content">
   
       				<h1 class="page-title"><?php
       					printf( __( '%s', 'twentyten' ), '<span>' . single_cat_title( '', false ) . '</span>' );
       				?></h1>
       				<?php
       					$category_description = category_description();
       					if ( ! empty( $category_description ) )
       						echo '<div class="archive-meta">' . $category_description . '</div>';
   
       				/* Run the loop for the category page to output the posts.
       				 * If you want to overload this in a child theme then include a file
       				 * called loop-category.php and that will be used instead.
       				 */
       				get_template_part( 'loop', 'category' );
       				?>
   
       			</div><!-- #content -->
   
       <?php get_footer(); ?>
       ```
   
 * Archive:
 *     ```
       <?php
       /**
        * The template for displaying Archive pages.
        *
        * Used to display archive-type pages if nothing more specific matches a query.
        * For example, puts together date-based pages if no date.php file exists.
        *
        * Learn more: http://codex.wordpress.org/Template_Hierarchy
        *
        * @package WordPress
        * @subpackage Twenty_Ten
        * @since Twenty Ten 1.0
        */
   
       get_header(); ?>
   
       		<div id="container">
       			<div id="content" role="main">
   
       <?php
       	/* Queue the first post, that way we know
       	 * what date we're dealing with (if that is the case).
       	 *
       	 * We reset this later so we can run the loop
       	 * properly with a call to rewind_posts().
       	 */
       	if ( have_posts() )
       		the_post();
       ?>
   
       			<h1 class="page-title">
       <?php if ( is_day() ) : ?>
       				<?php printf( __( 'Daily Archives: <span>%s</span>', 'twentyten' ), get_the_date() ); ?>
       <?php elseif ( is_month() ) : ?>
       				<?php printf( __( 'Monthly Archives: <span>%s</span>', 'twentyten' ), get_the_date( _x( 'F Y', 'monthly archives date format', 'twentyten' ) ) ); ?>
       <?php elseif ( is_year() ) : ?>
       				<?php printf( __( 'Yearly Archives: <span>%s</span>', 'twentyten' ), get_the_date( _x( 'Y', 'yearly archives date format', 'twentyten' ) ) ); ?>
       <?php else : ?>
       				<?php _e( 'Blog Archives', 'twentyten' ); ?>
       <?php endif; ?>
       			</h1>
   
       <?php
       	/* Since we called the_post() above, we need to
       	 * rewind the loop back to the beginning that way
       	 * we can run the loop properly, in full.
       	 */
       	rewind_posts();
   
       	/* Run the loop for the archives page to output the posts.
       	 * If you want to overload this in a child theme then include a file
       	 * called loop-archive.php and that will be used instead.
       	 */
       	 get_template_part( 'loop', 'archive' );
       ?>
   
       			</div><!-- #content -->
       		</div><!-- #container -->
   
       <?php get_sidebar(); ?>
       <?php get_footer(); ?>
       ```
   
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/category-shows-wrong-posts/#post-3500224)
 * nothing suspicious in category.php;
 * > when I’m opening category “news” it shows posts from blog.
 * what is the relation ship between those two cats?
    are both top level categories?
 * are you using any plugins?
    – is so, try to temporarily deactivate all plugins,
   to see if that helps.
 * you can then reactivate one plugin at atime to locate the interfering one.
 * does your problem change if you temporarily switch to the unedited default theme
   Twenty Twelve or Twenty Eleven?
 *  Thread Starter [grezliq](https://wordpress.org/support/users/grezliq/)
 * (@grezliq)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/category-shows-wrong-posts/#post-3500375)
 * Ok I think I know what’s wrong, but don’t know how to fix it:
 * As we can see, there’s a code in category template:
 *     ```
       /* Run the loop for the category page to output the posts.
       				 * If you want to overload this in a child theme then include a file
       				 * called loop-category.php and that will be used instead.
       				 */
       				get_template_part( 'loop', 'category' );
       				?>
       ```
   
 * And we look into loop.php:
 *     ```
       <?php
       	/* Start the Loop.
       	 *
       	 * In Twenty Ten we use the same loop in multiple contexts.
       	 * It is broken into three main parts: when we're displaying
       	 * posts that are in the gallery category, when we're displaying
       	 * posts in the asides category, and finally all other posts.
       	 *
       	 * Additionally, we sometimes check for whether we are on an
       	 * archive page, a search page, etc., allowing for small differences
       	 * in the loop on each template without actually duplicating
       	 * the rest of the loop that is shared.
       	 *
       	 * Without further ado, the loop:
       	 */ ?>
   
       <?php
                   $i = 0;
       		?>
        <?php query_posts($query_string . '&cat=1'); ?>
        <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
        <div class="blog-left">
       <?php if($i%2!=0) {  ?>
   
        <div class="post">
        <?php $photo = array(get_the_post_thumbnail( $post->ID, 'blog_photo')) ;?>
       ...
       ```
   
 * So we can see that if I open any category, it shows posts from category id=1.
 * How to change it? I have two categories in menu, both of them shows posts from
   category id=1… I would like to fix it.
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/category-shows-wrong-posts/#post-3500382)
 * > So we can see that if I open any category, it shows posts from category id=
   > 1.
 * remove the line
 *     ```
       <?php query_posts($query_string . '&cat=1'); ?>
       ```
   
 * the line should not be there – unless you want to restrict the posts of the start
   page to a certain category;
 * please give more details about the planned organisation of your site …
 *  Thread Starter [grezliq](https://wordpress.org/support/users/grezliq/)
 * (@grezliq)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/category-shows-wrong-posts/#post-3500388)
 * I deleted it. It’s ok now.
 * Thank you so much.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Category shows wrong posts’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 6 replies
 * 2 participants
 * Last reply from: [grezliq](https://wordpress.org/support/users/grezliq/)
 * Last activity: [13 years, 2 months ago](https://wordpress.org/support/topic/category-shows-wrong-posts/#post-3500388)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
