bug in wp-pagenavi plugin

I have downloaded the wp-pagenavi from this location. http://wordpress.org/extend/plugins/wp-pagenavi/installation/. I am using wordpress 3.3.1. I have installed this plugin using the instructions. I used the following code in home.php to display the posts and pagination.

<?php
/**
 * Template Name: Home Page
 */
get_header(); 


?>

<?php include(TEMPLATEPATH."/sidebar.php");?>

    <div id="content_right">
    <?php if ( function_exists('yoast_breadcrumb') ) {
    yoast_breadcrumb('<div id="breadcrumbs">','</div>');
} ?>
<div class="clear">&nbsp;</div>
<?php 
// Display most recent posts

$the_query = new WP_Query( "showposts=5" );
$postcount = 0;
while ( $the_query->have_posts() ) : $the_query->the_post();
$postcount++;
 ?>

<div class="blog_left">
<div><?php
if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
  the_post_thumbnail();
} 
?>

</div>
</div>
<div class="blog_right">
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<div>in: <?php the_category(', ') ?></div>
<?php the_excerpt(); ?>
</div>
 <div class="clear"></div>

<?php
if( $postcount != 5){?> 
 <p class="blogdivider"></p>

<?php } ?>

<?php endwhile; 
$count = 0;
?>
<?php wp_pagenavi(); ?>

    </div>
<?php get_footer(); ?>

But pagination doesn’t display in my webpage. I couldn’t track what is missing. Any suggestions?

Related posts

Leave a Reply

2 comments

  1. try

            <?php
    
    $paged = intval(get_query_var('paged'));
    
    if($paged == 0) {
    
    $paged = 1;
    
    }
    
    ?>
    

    or

    $the_query = new WP_Query( "showposts=5,get_query_var=paged" );
    
  2. This form works:

     //if not exists assigns value 1
     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; 
    
     //query 5 posts
     query_posts("posts_per_page=5&paged=$paged");