the_post() falls outside of loop but is still in the loop
-
Hi,
My output HTML is being strange and <h1> and <p> tags are blank underneath my actual data
$postlist = new WP_Query( $args ); if ( $postlist->have_posts() ) : while ( $postlist->have_posts() ) : $postlist->the_post(); the_post_thumbnail(); echo '<h1>'.the_title().'</h1>'; echo '<p>'.the_excerpt().'</p>'; echo '<hr>'; endwhile; //twentysixteen_paging_nav(); else : get_template_part( 'content', 'none' ); endif;
this is happening:
New post<h1></h1>
- The topic ‘the_post() falls outside of loop but is still in the loop’ is closed to new replies.