Skip to content

Instantly share code, notes, and snippets.

@danielpowney
Last active October 26, 2017 22:27
Show Gist options
  • Save danielpowney/c660c4f1cc47517572a2dffbd02d3e4b to your computer and use it in GitHub Desktop.
Save danielpowney/c660c4f1cc47517572a2dffbd02d3e4b to your computer and use it in GitHub Desktop.
The WordPress Loop example
<?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