Search This Blog

Tuesday, 28 November 2017

Get custom post type in wordpress.

Get custom post type in wordpress.

$args = array( 'post_type' => 'my_custom_post', 'posts_per_page' => 10 );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
  the_title();
  echo '<div class="entry-content">';
  the_content();
  echo '</div>';
endwhile;

No comments:

Post a Comment