Display posts from WordPress custom post type

Published:

There are more than a few way to show a Custom Post Type in WordPress.  This has been by far the best way to not just show custom post types, normal posts, but also retain a lot of WordPress default functionality.

<?php
   $args = array(            
     'post_type' => 'any-post-type',
     'posts_per_page' => 4, 
   );
  $query = query_posts($args);
?>
<?php  while (have_posts()) : the_post(); ?>

    <?php the_title();?>

 <?php endwhile; wp_reset_query();?>