Basic Article Post Query
// WP_Query arguments
$args = array(
'post_type' => array( 'articles' ),
'nopaging' => true,
'ignore_sticky_posts' => true,
'order' => 'ASC',
'orderby' => 'title',
'tax_query' => array(
array(
'taxonomy' => 'category',
'operator' => 'EXISTS',
'include_children' => false,
),
),
);
// The Query
$art_query = new WP_Query( $args );
// The Loop
if ( $art_query->have_posts() ) {
while ( $art_query->have_posts() ) {
$art_query->the_post();
// do something
}
} else {
// no posts found
}
// Restore original Post Data
wp_reset_postdata();