Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Portfolio Query

// WP_Query arguments
$args = array (
	'post_type'              => 'portfolio',
	'post_status'            => 'publish',
	'category_name'          => 'news',
	'pagination'             => true,
	'posts_per_page'         => '5',
	'ignore_sticky_posts'    => true,
	'order'                  => 'ASC',
	'orderby'                => 'id',
	'year'                   => '2015',
	'monthnum'               => '6',
);

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

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

// Restore original Post Data
wp_reset_postdata();