Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

WP Query Post from categories

// WP_Query arguments
$args = array (
	'post_type'              => 'post',
	'post_status'            => 'publish',
	'cat'                    => '1,2',
	'pagination'             => false,
	'posts_per_page'         => '5',
	'ignore_sticky_posts'    => false,
	'offset'                 => '3',
	'cache_results'          => true,
	'update_post_meta_cache' => true,
);

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

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

// Restore original Post Data
wp_reset_postdata();