Last active
October 26, 2017 22:27
-
-
Save danielpowney/c660c4f1cc47517572a2dffbd02d3e4b to your computer and use it in GitHub Desktop.
The WordPress Loop example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// The Query | |
$q1 = new WP_Query( $args ); | |
// The Loop | |
if ( $q1->have_posts() ) { | |
while ( $q1->have_posts() ) { | |
$q1->the_post(); | |
// Post content here | |
} | |
// Restore original post data | |
wp_reset_postdata(); | |
} else { | |
// No posts found | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment