Skip to content

Instantly share code, notes, and snippets.

@flegfleg
Created May 18, 2014 21:57
Show Gist options
  • Save flegfleg/f687a920ff134dff77b8 to your computer and use it in GitHub Desktop.
Save flegfleg/f687a920ff134dff77b8 to your computer and use it in GitHub Desktop.
wp secondary loop
<?php
// get news
$args = array ('post_type'=> 'post', 'posts_per_page' => 5 );
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) :
while ( $the_query->have_posts() ) : $the_query->the_post();
get_template_part('news', 'compact');
endwhile; endif;
wp_reset_postdata();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment