Today, We want to share with you wordpress display posts from specific category on page.In this post we will show you how to display all posts from a category wordpress, hear for display category on page – wordpress we will give you demo and example for implement.In this post, we will learn about wordpress Get All Parent Categories from Child Categories with an example.
wordpress display posts from specific category on page
There are the Following The simple About display category wise post in wordpress Full Information With Example and source code.
As I will cover this Post with live Working example to develop wordpress only show posts from specific category, so the wordpress display posts from specific category on page plugin is used for this example is following below.
Display content from a specific category
list of posts under the ‘WordPress’ category.
$args = array( 'post_type' => 'post', 'post_status' => 'publish', 'category_name' => 'wordpress', 'posts_per_page' => 5, ); $arr_posts = new WP_Query( $args ); if ( $arr_posts->have_posts() ) : while ( $arr_posts->have_posts() ) : $arr_posts->the_post(); ?>> here simple use the key as ‘cat’ in place of custom ‘category_name’ as well as here pass the id of a category
$args = array( 'post_type' => 'post', 'post_status' => 'publish', 'cat' => '4', // 2,3,4,5,6,8,9,15 or more you can pass comma-separated ids here 'posts_per_page' => 5, );Get Posts Under Custom Taxonomy
$args = array( 'post_type' => 'CUSTOM_POST_TYPE_NAME', 'post_status' => 'publish', 'posts_per_page' => 5, 'tax_query' => array( array( 'taxonomy' => 'TAXONOMY_NAME', 'field' => 'slug', 'terms' => array( 'TERM_SLUG' ), 'operator' => 'IN' ), ), ); $arr_posts = new WP_Query( $args );using Pagination
get the value for paged
$paged = (get_query_var( 'paged' )) ? get_query_var( 'paged' ) : 1;template-category.php
'post', 'post_status' => 'publish', 'category_name' => 'wordpress', 'posts_per_page' => 5, 'paged' => $paged, ); $arr_posts = new WP_Query( $args ); if ( $arr_posts->have_posts() ) : while ( $arr_posts->have_posts() ) : $arr_posts->the_post(); ?> > $arr_posts, ) ); endif; ?>Summary
You can also read about AngularJS, ASP.NET, VueJs, PHP.
I hope you get an idea about wordpress display posts from specific category on page.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.