Display post type using WP Query

banner-image

If you want to display any wordpress custom post type using the WP Query, you have to follow the below method.

Using the below while-loop query, you can call any post types data.

$wp_query = new WP_Query( array( 'post_type' => 'post_type_name','showposts' => '3', 'order'=>'ASC') ); //replace post_type_name with yours post type name
while ($wp_query->have_posts()) : $wp_query->the_post();
  the_title();
  the_content();
endwhile;

 

For more details, visit here.

Tags:

Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x