好的,這可能是一個簡單的。但我似乎無法找出出於某種原因。在循環中顯示自定義分類Wordpress
我有一個自定義的帖子類型叫做:Beachevents。 我有幾個活動。我也有一個名爲:Thema的自定義分類。
當做我的beachevent頁面(不是職位),我創建了一些類型的主題(主題)。比如:Strand Spellen(slu is子彈)。
現在我想製作一個循環,顯示的只有縮略圖和所有東西的鏈式拼圖。
有沒有人知道我是如何去做這件事的?
我嘗試了一些這樣的代碼,但不要做伎倆。
$args = array(
'post_type' => 'beachevents',
'posts_per_page'=> -1,
'tax_query' => array(
array(
'taxonomy' => 'strand-spellen',
'field' => 'slug',
'terms' => 'all'
)
)
);
$products = new WP_Query($args);
if($products->have_posts()) {
while($products->have_posts()) {
$products->the_post();
?>
<div class='content'>
<h2><?php the_title(); ?></h2>
</div>
<?php
}
}
else {
echo 'There seems to be a problem, please try searching again or contact customer support!';
}
謝謝!
+1上一個很好解釋的問題,與相關的代碼,並在您的設置上的細節:)使得它比這裏的一些其他問題更容易回答! –