0
我試圖創建一個循環,在某些帖子結束時,將拉動相關類別的帖子並排除當前帖子。我覺得我很接近,但仍然沒有工作。這只是因爲某些原因而拉出所有帖子。任何幫助將非常感激。WordPress的循環,拉相關類別的帖子
$args = array(
'posts_per_page' => 8,
//'paged' => get_query_var('paged'),
'post__not_in' => array($post->ID),
'category__in' => $cat_ID
);
// The Query
query_posts($args);
// The Loop
while (have_posts()) : the_post(); ?>
<div style="max-width: 1350px; margin: auto;">
<div id="post-container02">
<div class="post-image"><a href="<?php the_permalink();?>"> <?php the_post_thumbnail(); ?></a></div>
<div class="post-feed-title"><a href="<?php the_permalink();?>"> <?php the_title(); ?></a></div>
<div class="read-more-button"><a href="<?php the_permalink(); ?>">Read More</a></div>
</div><!-- post-container01 -->