2015-09-06 75 views
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; 

我的网站:http://www.overso.me/

任何想法?

+0

您shouln't使用query_posts()如果这不是主循环。相反,尝试使用'new WP_Query($ args)'上的相同参数。 –

+0

@Andreas Krischer我试过了,它不起作用:/ –

回答