Pages

How to get the custom post type content in wordpress

Friday, 3 January 2014

How to get the custom post type content in wordpress

  <?php
$wp_query= null;
$wp_query = new WP_Query();
$args = array(
'post_type' => 'testimonial',
'showposts' => '2',

);
$wp_query->query( $args );
?>
<?php if ( $wp_query->have_posts() ) : ?>

<?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>

<!-- Output testimonial here -->
<div class="testimonial_content">

<?php the_content (); ?>
</div>
<?php endwhile; ?>

<?php endif; ?>
 

Most Reading