Show Blog Posts
// WP_Query arguments
$args = array(
'post_type' => array( 'posts' ),
'post_status' => array( 'publish' ),
'nopaging' => false,
'posts_per_page' => '12',
'order' => 'DESC',
'orderby' => 'date',
'tax_query' => array(
array(
'taxonomy' => 'category',
'terms' => 'blog',
'field' => 'slug',
'include_children' => true,
),
array(
),
),
);
// The Query
$blog = new WP_Query( $args );
// The Loop
if ( $blog->have_posts() ) {
while ( $blog->have_posts() ) {
$blog->the_post();
// do something
}
} else {
// no posts found
}
// Restore original Post Data
wp_reset_postdata();