1
我已經爲它創建了自定義文章類型和分類標準。我希望管理員能夠在創建新頁面(頁面)時選擇他們希望在頁面上顯示的分類標準。我創建了一個自定義頁面模板,並且有一個條件自定義字段顯示可用的分類,當選擇該模板時。使用自定義帖子類型用戶界面和高級自定義字段插件。顯示從頁面的自定義字段(WP)中選擇的自定義文章類型分類標準
<?php
// this one gets taxonomy custom field
$taxo = get_field('top_to_show');
// and from here on, it outputs the custom post type
$args = array(
'post_type' => 'top_item',
'post_status' => 'publish',
'tops' => $taxo
);
$lineblocks = new WP_Query($args);
if($lineblocks->have_posts()) {
while($lineblocks->have_posts()) {
$lineblocks->the_post();
?>
<div>Custom post type layout html</div>
<?php
}
}
else {
echo '';
}
wp_reset_query(); ?>
現在,當我爲頁面的分類定製字段選擇「術語ID」時,它根本不顯示任何內容。當選擇「術語對象」時,它會顯示所有分類法中的所有文章,而不是特別選擇的文章。
如何讓它顯示特別選定的分類標準?