I created a child theme for the tweentysixteen theme template. I see the main loop located in index.php, but noticed that after the while statement, there is no display of wp_reset_postdata();
If I was to put it there, would the the loop gain any benefit?
For testing purposes I want to display a second loop under the first one, with page limits. I am assuming it should look like this...
$mposts = new WP_Query('posts_per_page=3');
while ( $mposts->have_posts() ) : $mposts->the_post();
get_template_part( 'template-parts/content', get_post_format() );
endwhile;
and if that is correct, do I place a wp_reset_query
, before this process or after it? if it is helpful to have it, why does it matter where it is placed?
Thanks!
wp_reset_query()
and instead be usingwp_reset_postdata()
. – Howdy_McGee♦ Oct 5 '16 at 15:14