1 回答

TA貢獻(xiàn)1852條經(jīng)驗(yàn) 獲得超7個(gè)贊
檢查此代碼。
$args = array(
'post_type' => 'knowledge_base',
'tax_query' => array(
array(
'taxonomy' => 'section',
'field' => 'slug', // ‘term_id’, ‘name’, ‘slug’ or ‘term_taxonomy_id’
'terms' => $current->slug, // It's will be $term->slug
)
)
);
// The Query
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) {
echo '<ul>';
while ( $the_query->have_posts() ) {
$the_query->the_post();
echo '<li>' . get_the_title() . '</li>';
}
echo '</ul>';
}
- 1 回答
- 0 關(guān)注
- 138 瀏覽
添加回答
舉報(bào)