Ok so here's another story for my Custom Pagination on Custom Author's Page. What i want to happen there is display the Author's avatar, description, website, and some additional fields, and of course list his post and paginate it....
Here's the screenshot of my custom author page: http://i56.tinypic.com/2cosldy.png
As you can see, everything seems to be in order. Now, the problem is the pagination. I used the code by Kreisi (Pagination w/o using plugins). What i did is create a custom loop and call it to Kreisi's function
here's the code
$uid = $curauth->ID;
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$authloop = new WP_Query("author=$uid&paged=$paged");
$ppp = 5; //set my custom number of post to appear
$args = array(
'post_per_page' => $ppp,
'author' => $uid,
'paged' => $paged
);
$authorposts = get_posts($args);
if ( count( $authorposts ) > 0 ) {
foreach ( $authorposts as $post ): setup_postdata($post)
?>
<li>
<?php if ( has_post_thumbnail() ) : ?>
<img src="<?php echo bloginfo('template_url'); ?>/inc/scripts/timthumb.php?src=<?php echo catch_that_image(); ?>&w=40&h=40&zc=1&q=30" alt="<?php the_title(); ?>" class="authorpostimg"/>
<?php else : ?>
<img src="<?php echo bloginfo('template_url'); ?>/inc/scripts/timthumb.php?src=<?php echo catch_that_image(); ?>&w=40&h=40&zc=1&q=100" alt="<?php the_title(); ?>" class="authorpostimg"/>
<?php endif; ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>" class="authorpostlink"><?php the_title(); ?></a>
<?php the_excerpt(); ?>
</li>
<?php
endforeach;
wnw_authpagination($authloop->max_num_pages);
} else {
echo '<p>No articles by this user</p>';
}
Here's the scenario for further understanding
Supposed the blog has a total of 30 blog posts, and the author Ven Francis has 15. If you can see on my variable, i did set the post_per_page value to 5. And on Kreisi's function it has the range of 2. (please visit the link to his code to further figure it out) So what it has to happen is that, pagination should show 5 page-buttons
[c] [2] [3] [>] [>>]
where [c] is the current... [3] and [>>] is the last page(3rd page). But what is happening on my situation is that, when you hover the [>>] it shows /page/6 and i think it's getting the total number of posts of the blog.
And if you click on 3(3rd page). It will still show the 4,5 and [>>] and it should not. like below illustration
[<<] [<] [1] [2] [c] [4] [5] [>] [>>]
I hope you understand the scenario and the problem. Thanks again and God bless!
PS: kreisi's not doing a support for his brilliant code anymore, so i gotta do this on my own. an i need a little help from you guys. Thank you!