Trying to use paging in one of my Wordpress site but seems it is not working.for paging i am using SEO Pager Plugin. here is my code

$params = get_query_var('args'); 
    $ppp = get_option('posts_per_page');
    if (!is_paged()) {
                    $custom_offset = 0;
            } else {
                $custom_offset = $ppp*($paged-1);   
$args = array( 'meta_key' => 'post_author', 'meta_value' => $params ,'numberposts' => $ppp,'offset' => $custom_offset);
        $authorposts=get_posts($args); echo count($authorposts);?>

now i am displaying post results inside the loop and i have placed

<?php SEO_pager(); ?>

outside the loop as per the instructions.I have total 239 posts with a given author but its showing only 5 post and no paging is being shown when i set number numberposts to -1 its showing all the posts but when using the default settings (5) it is showing only 5 posts with no paging options

can any one point where i am doing wrong


I used the following code and paging options came but when i am clicking on any page it showing no result, no sure how can i fix that

$params = get_query_var('args'); 
            $ppp = get_option('posts_per_page');
            $args = array(
                            'meta_key' => 'post_author',
               'meta_value' => $params ,
               'numberposts' => $ppp,
                          'post_type' => 'post',
                         'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1),


any suggestion what i am doing wrong?

| improve this question | | | | |
  • Can you show the content or $args? – kevin Jan 19 '12 at 14:05
  • $argrs is post_author name which is being taken from the URL – Umesh Awasthi Jan 19 '12 at 14:13
  • Try to add the pagination parameter to the query's parameters in $args: &paged='.$paged.' – kevin Jan 19 '12 at 14:43
  • @kevin that's the entry page so there i believe is no need to add pagination parameter and i am setting the global $paged variable. – Umesh Awasthi Jan 19 '12 at 14:50
  • If it's the main blog page, why did you change the original query? – kevin Jan 19 '12 at 15:39


Here's how i got it working fine on localhost:

I installed the plugin and set the option Place Pager Automatically in Template on "on". Then in author.php i modified the original query to add some custom parameters. I added this:

global $query_string; // required
$posts = query_posts('posts_per_page=2');

right between rewind_posts(); and get_template_part( 'loop', 'author' );.

That way i could customize the query (in this case i'm showing 2 posts per page) and get the plugin working perfectly.

This test is based on TwentyTen.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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