Wordpress Query for Custom Post Types
<?php
$postTypeToQuery = "examplemovies";
$args = array( 'post_type' => $postTypeToQuery, 'posts_per_page' => 10 );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
?>
<div class="post">
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> </h2>
<?php the_content(); ?>
</div>
<?php
endwhile;
?>
Written by Elias Sierra
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Wordpress
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#