I have 3 divs that WP_Query with 3 different categories and end it with the php endwhile,but it only shows the same most recent post query three times over. Do I need to hard reset the query loop somehow? I'm looking to see where to put wp_reset_postdata...
<div>
<?php $test = new WP_Query('category=[errands]&showposts=1');
while ($test->have_posts()) : $test->the_post(); ?>
<h2><?php the_title(); ?></h2>
<img src="<?php bloginfo('template_directory'); ?>/images/errands.jpg" />
<?php the_content(__('Read more'));?>
<?php endwhile;?>
<?php wp_reset_postdata(); ?>
</div>
<div>
<?php $test2 = new WP_Query('category=[shopping]&showposts=1');
while ($test2->have_posts()) : $test2->the_post(); ?>
<h2><?php the_title(); ?></h2>
<img src="<?php bloginfo('template_directory'); ?>/images/shopping.jpg" />
<?php the_content(__('Read more'));?>
<?php endwhile;?>
<?php wp_reset_postdata(); ?>
</div>
<div>
<?php $test3 = new WP_Query('category=[calendar_maintenance]&showposts=1');
while ($test3->have_posts()) : $test3->the_post(); ?>
<h2><?php the_title(); ?></h2>
<img src="<?php bloginfo('template_directory'); ?>/images/calendar.jpg" />
<?php the_content(__('Read more'));?>
<?php endwhile;?>
<?php wp_reset_postdata(); ?>
</div>
wp_reset_postdata()
(see Codex here) ? ps:posts_per_page
is the newshowposts
.