Get post by category id in custom post type with custom taxonomy

Snippet for create custom post type and it’s taxonomy.

$termsID = '191'; #e.i

	$dalwadi_ourteam_args = array(
		'post_type' => 'ourteam',
		'orderby' => 'post_date',               
		'order' => 'DESC',
		'post_status' => 'publish',		
		'tax_query' => array(
			array(
				'taxonomy' => 'member-category',
				'field' => 'term_id',
				'terms'    => $ourteam_category_check
			),
		),
	);
	
	$dalwadi_ourteam = new WP_Query($dalwadi_ourteam_args);
	
	while ($dalwadi_ourteam->have_posts()) : $dalwadi_ourteam->the_post();
		/*** My loop code ***/
	endwhile;
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s