Created
October 10, 2012 19:05
-
-
Save jlittlejohn/3867718 to your computer and use it in GitHub Desktop.
WP: Output Posts from Custom Post Type
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment