Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Query by Category and Custom Fields

Query by Category and Custom Fields

// WP_Query arguments
$args = array(
);

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

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

// Restore original Post Data
wp_reset_postdata();