erlendmr
10/26/2017 - 7:51 AM

WP_Query

Interacting with WP_Query

<?php

$args = [
	'post_type' => 'post'
];

$the_query = new WP_Query( $args );

?>

<?php if ( $the_query->have_posts() ) : ?>
	<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
	
	<!-- Content Here -->
	
	<?php endwhile; ?>
	
	<?php wp_reset_postdata(); ?>
<?php endif; ?>