Skip to content

Instantly share code, notes, and snippets.

@trentsnippets
Created June 20, 2013 11:34
Show Gist options
  • Save trentsnippets/5822023 to your computer and use it in GitHub Desktop.
Save trentsnippets/5822023 to your computer and use it in GitHub Desktop.
Wordpress Loop for a custom post type.
<?php
$args = array( 'post_type' => 'product', 'posts_per_page' => -1 );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
the_title();
the_content();
endwhile;
/* 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