Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to add paging to the query below. However, I can't seem to get the paging to work. It shows previous/next links, however, they always show the same 2 posts. There are 8 posts in this query.

//$paged = get_query_var( 'page' );
wp_reset_query();

global $post;

$args = array('posts_per_page' => 2,'paged'=>1);
$posts = get_posts($args);
share|improve this question
    
You are overwriting any pagination variables with 'paged' => 1, it's not a boolean flag but the current page indicator. –  Horacio Nuñez Apr 23 '12 at 18:08
add comment

1 Answer

up vote 1 down vote accepted

If you make paged equal to get_query_var( 'paged' ) that should do the trick. You may need to do something like $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1; and then set paged to $paged.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.