我想顯示具有自定義分類的自定義帖子類型,但我沒有任何運氣。什麼都沒有顯示出來。我感謝任何幫助。自定義分類WP_Query
類型=畫廊
自定義分類蛞蝓= photoarea
的 'photoarea' 我想顯示=第四
<?php
$args = array(
'post_type' => 'gallery',
'tax_query' => array(
array(
'taxonomy' => 'photoarea',
'field' => 'fourth',
)
),
'posts_per_page' => 10,
);
$the_query = new WP_Query($args);
if ($the_query->have_posts()) : while ($the_query->have_posts()) : $the_query->the_post();
the_post_thumbnail();
endwhile; endif;
wp_reset_query();
?>
不適用於我。它觸發了一個PHP通知。 –
你需要'field'=>'slug'和'terms'=>'fourth'來獲得這項工作,而不是'term'。 –