Lets you have post type called ‘blog_posts’ , and you want to fetch 5 posts of that post type . Here is what you need to do:
1 2 3 4 5 6 7 | $args = array( 'post_type' => 'blog_posts', 'posts_per_page' => '5', ); $query = new WP_Query($args); |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.