Skip to content

Instantly share code, notes, and snippets.

@raewrites
Created January 16, 2015 06:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raewrites/5cfc443290a213a93cde to your computer and use it in GitHub Desktop.
Save raewrites/5cfc443290a213a93cde to your computer and use it in GitHub Desktop.
Using WP_Query
<?php
$args = array(
// arguments for your query
);
// the query
$query = new WP_Query( $args );
// The Loop
if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post() :
// contents of the Loop go here
endwhile : endif;
/* Restore original Post Data */
wp_reset_postdata();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment