0
我一直在創建自定義循環並設置每頁有多少帖子。我需要將此循環與每頁上的博客文章分開 - 因此是自定義循環。分頁不能在自定義Wordpress循環上工作
現在循環可以正常工作,但是我發現它與pagniation衝突......分頁顯示,但是當點擊'next'時頁面沒有改變。
這裏是我的循環:
<?php
$args = array('posts_per_page'=>12, 'post_type' =>'office');
$category_posts = new WP_Query($args);
if($category_posts->have_posts()) :
while($category_posts->have_posts()) :
$category_posts->the_post();
?>
<div class="office-item-wrapper">
<div class="office-item">
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
</article>
</div>
</div>
<?php endwhile; ?>
<?php else: ?>
<article>
<h2><?php _e('Sorry, nothing to display.', 'html5blank'); ?></h2>
</article><!--/ Article -->
<?php endif; ?>
在此先感謝任何人誰也許能夠幫我解決這個問題:-)
感謝您的回答。我將如何在上述代碼中實現這一點? – Charly
不客氣。然後選擇我的答案作爲答案。只需複製並粘貼我的代碼並替換您的$ args行 – Skatox