jlittlejohn
10/10/2012 - 7:05 PM

WP: Output Posts from Custom Post Type

WP: Output Posts from Custom Post Type

<?php  
  $args = array( 'post_type' => 'my_post_type', 'posts_per_page' => 10 );
  $loop = new WP_Query( $args );
  while ( $loop->have_posts() ) : $loop->the_post();
    echo '<h2>';
    the_title(); 
    echo '</h2><p>';
    the_excerpt(); // the_content();
    echo '</p><a href="';
    the_permalink();
    echo '" class="btn">Read more »</a>';
  endwhile; wp_reset_postdata();
?>