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 having some problem with page pagination using wp-pagenavi, i'm using this query:

$myposts = query_posts( array( 'showposts' => 10, 'paged' => get_query_var('paged') ) );;

i would that had 10 posts per page, in fact, it pages, but it only pages with 5 posts per page, i have 18posts, and cant have success to paginate.

At Configurations > Reading > Posts per page: 10.

What can be my problem?

code: http://pastebin.com/TC7eBuFh

share|improve this question
    
Can you show us more code than this? The query_posts() function is not recommended, so most of us wouldn't use it if someone pointed a gun to our head. We need to see more code so we can run it to test it for you. –  Charles Clarkson Sep 24 '13 at 16:34
    
@CharlesClarkson code added. –  Matheus Silva Sep 24 '13 at 17:42
    
Thanks. The code in the link has showposts set to 5, not 10. –  Charles Clarkson Sep 24 '13 at 17:54

1 Answer 1

Try this:

<?php get_header(); ?>

<div id="content">
    <div id="page">

<?php
global $post, $paged;

if ( get_query_var( 'paged' ) )
    // On a paged page.
    $paged = get_query_var( 'paged' );

else if ( get_query_var( 'page' ) )
    // On a "static" page.
    $paged = get_query_var( 'page' );

// Default.
else
    $paged = 1;

$myposts = query_posts( array(
    'posts_per_page' => 10,
    'paged' => $paged,
) );
share|improve this answer
    
seens this doent make any difference, try this image, it paged only 5 itens again =/ i227.photobucket.com/albums/dd243/PlayMa256/… –  Matheus Silva Sep 24 '13 at 22:14
    
Try using the get_posts() function in place of the query_posts() function. Replace $myposts = query_posts( array( with $myposts = get_posts( array(. –  Charles Clarkson Sep 25 '13 at 1:48
    
its impossible, it keeps paginating only 5 posts, i have 18, i was to paginate 10 at first page, and 8 at second....GOD WHY! –  Matheus Silva Sep 25 '13 at 16:37

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.