I am a relatively new developer, and just started with wordpress. I want for each post to be wrapped in a class of post. I keep getting this error no matter what i do. If i echo the div or add post_class.
<div class="posts">
<?php
$args = array(
'post_type' => 'post',
'posts_per_page' => 4
);
// Variable to call WP_Query.
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) :
// Start the Loop
while ( $the_query->have_posts() ) : $the_query->the_post();
echo '<div class='post'>'
the_post_thumbnail();
the_title('<h2>','</h2>');
the_excerpt();
echo '</div>'
endwhile;
else:
// If no posts match this query, output this text.
_e( 'Sorry, no posts matched your criteria.', 'textdomain' );
endif;
wp_reset_postdata();
?>
</div>
question from:
https://stackoverflow.com/questions/65650219/add-a-div-inside-wordpress-loop 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…