wordpress カスタム投稿 表示条件設定
<?php $paged = get_query_var('paged'); $args = array( 'posts_per_page' => '-1', 'cat' => '', 'tax_query' => array( array( 'taxonomy' => 'custominfo_category', //タクソノミーを指定 'field' => 'slug', //ターム名をスラッグで指定する(変更しない) 'terms' => array('pref') //表示したいタームをスラッグで指定 ), ), 'offset' => '', 'category_name' => '', 'orderby' => 'date', 'order' => 'DESC', 'include' => '', 'exclude' => '', 'post_type' => 'custominfo', 'post_parent' => '', 'author' => '', 'post_status' => 'publish', 'paged' => $paged ); query_posts($args); ?>
または、
array( 'post_type' => 'shops', 'posts_per_page' => 5, 'tax_query' => array( array( 'taxonomy' => 'shop_category', 'field' => 'slug', 'terms' => array( 'cafe', 'grocery', ), ), ), )