It is necessary to display posts from different headings on one page, but when I indicate heading 2 and 3 in the code, then all posts from all headings are displayed in them? In the recording of the question mark, the rubrics are correct, what could be the problem?
<?php $top_query = new WP_Query('showposts=-1'); ?> <?php if ( have_posts() ) : query_posts('cat=2'); // указываем ID рубрик, которые необходимо вывести. while($top_query->have_posts()) : $top_query->the_post(); $first_post = $post->ID; ?> <div class="news-item"> <a href="<?php the_date('dmY' ); ?>"><?php the_post_thumbnail('full');?></a> <h4 class="ni-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4> <p class="ni-desc"><?php the_excerpt(); ?></p> <div class="ni-footer clearfix"> <a href="<?php the_permalink(); ?>" class="ni-more">читать далее</a> <span class="ni-date"><?php the_date('dmY' ); ?></span> </div> </div> <?php endwhile; ?> <?php else : ?> <?php endif; ?> <?php wp_reset_query(); ?> </div> <div class="middle-news-block clearfix"> <?php $top_query = new WP_Query('showposts=-1'); ?> <?php if ( have_posts() ) : query_posts('cat=3'); // указываем ID рубрик, которые необходимо вывести. while($top_query->have_posts()) : $top_query->the_post(); $first_post = $post->ID; ?> <div class="middle-news-item"> <a href="<?php the_permalink(); ?>"> <?php the_post_thumbnail('full');?> <h2 class="mni-title"><?php the_title(); ?></h2> <span class="mni-date"><?php the_date('dmY' ); ?></span> </a> </div> <?php endwhile; ?> <?php else : ?> <?php endif; ?> <?php wp_reset_query(); ?> </div>