Skip to content

Instantly share code, notes, and snippets.

@nateluzod
Created January 27, 2013 02:25
Show Gist options
  • Save nateluzod/4645893 to your computer and use it in GitHub Desktop.
Save nateluzod/4645893 to your computer and use it in GitHub Desktop.
Looping through list of custom post types.
<?php $loop = new WP_Query( array( 'post_type' => 'post_type', 'posts_per_page' => 10 ) ); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<article>
<a href="<?= get_permalink();?>"><h2><?= the_title();?></h2></a>
<?php the_excerpt(); ?>
</article>
<?php endwhile; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment