Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

List Articles Grouped by Category

// WP_Query arguments
$args = array(
	'post_type'              => array( 'articles' ),
	'nopaging'               => true,
	'ignore_sticky_posts'    => true,
	'order'                  => 'ASC',
	'orderby'                => 'title',
	'tax_query'              => array(
		'relation' => 'AND',
		array(
			'taxonomy'         => 'category',
			'field'            => 'name',
			'operator'         => 'EXISTS',
		),
	),
);

// The Query
$article_query = new WP_Query( $args );

// The Loop
if ( $article_query->have_posts() ) {
	while ( $article_query->have_posts() ) {
		$article_query->the_post();
		// do something
	}
} else {
	// no posts found
}

// Restore original Post Data
wp_reset_postdata();