0
我在一些文章中看到,query_post的分頁必須由參數'paged'啓動。Wordpress分頁query_post
不幸的是,這是行不通的:在第2頁仍是一樣的頁面1
我的代碼:
if (have_posts()) :
$args = array(
'category_name' => 'interview',
'post_type' => 'post',
'posts_per_page' => 1,
'paged' => (get_query_var('paged') ? get_query_var('paged') : 1),
);
query_posts($args);
while (have_posts()) : the_post();
the_title();
endwhile;
previous_posts_link('Previous');
next_posts_link('Next');
wp_reset_query();
else :
endif;
任何想法?
您shouln't使用query_posts()如果這不是主循環。相反,嘗試使用'new WP_Query($ args)'上的相同參數。 –
@Andreas Krischer我試過了,它不起作用:/ –