Sourceパターン(Term→Post) tax_query

class code37179
{
	public function __construct()
	{
		$args = array(
			'model' => '37179',
			'view' => '37179',
			'tax' => array('region','genre'),//タクソノミー名:地域、ジャンル
			'field_value' => array('9790','10274'),	//タクソノミーの値:中央区、商店街		
			'post_type' => 'post',//投稿タイプ:ブログ記事
		);
		$user = new Controller37179($args) ;
	}//endfunction
}//endclass

class Controller37179
{	
	public function __construct($args)
	{
//////配列をオブジェクトに変換
		$par =(object)$args;
//////Modelクラスの呼び出し
		$model_name = 'Model'.$par->model ;	
		$model_obj = new $model_name($par) ;
	}//endfunction
}//endclass

class Model37179//投稿を表示
{
	public function __construct($par)
	{

		$args = array(		
			'post_type' => $par->post_type,
			'tax_query' => array(
			'relation' => 'OR',
				array(
					'taxonomy' => $par->tax[0],				
					'field' => 'term_id',
					'terms' => $par->field_value[0],
				),
				array(
					'taxonomy' => $par->tax[1],				
					'field' => 'term_id',
					'terms' => $par->field_value[1],
				)
			)
		);
		$the_query = new WP_Query($args) ;

//ループ~表示処理(Viewクラス)の呼び出し。
		if($the_query->have_posts()){
			While($the_query->have_posts()){
				$the_query->the_post();
					$view_name = 'View'.$par->view ;
					$view_obj = new $view_name($par) ;
			}
		}//endif
	}//endfunction
}//endclass


class View37179
{
	public function __construct($par)
	{
		the_title() ;
		echo "<br>\n" ;
	}//endfunction
}//endclass

参考文献

参考記事