2015-10-05 154 views
0

我在WP_Query中使用數組,這是爲index.php頁面。代碼是這樣的WordPress分頁不能與排除的文章工作

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; 

    $args = new WP_Query(array(
     'post__not_in'  => $exclude_ids, // This works correctly 
     'paged'    => $paged, 
     'posts_per_page'  => 9, // I added this as a hope but didn't work 
    )); 

$the_query = new WP_Query($args); ?> 



<?php if ($the_query->have_posts()) : while ($the_query->have_posts()) : $the_query->the_post(); ?> 

但分頁不起作用。我echod採取了$paged出來,它做1,2,3應該(我假設?),所以它的部分工作,並且URL正在改變,分頁鏈接識別它在頁面1,2,3但帖子都是一樣的。

+0

我將'paged'更改爲2和3,但帖子仍然相同。 – Sjrsmile

回答

0

原來我很笨。

我有,但$argsnew WP_Query,而它應該只是陣列。