Skip to content

Instantly share code, notes, and snippets.

@smonteverdi
Created March 7, 2012 15:40
Show Gist options
  • Save smonteverdi/1993855 to your computer and use it in GitHub Desktop.
Save smonteverdi/1993855 to your computer and use it in GitHub Desktop.
WordPress: Loop through custom post types
$args = array( 'post_type' => 'product', 'posts_per_page' => 10 );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
the_title();
echo '<div class="entry-content">';
the_content();
echo '</div>';
endwhile;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment