Search code examples
wordpressblogs

Call to undefined function wp_pagenavi() Error in Wordpress pagination


I'm currently working on a WordPress blog post using wp_query and I've encountered a problem in the last wp_pagenavi(); the error message is "Fatal error: Call to undefined function wp_pagenavi()" Here's is my code. I hope you can enlighten me about my problem.

<?php 
$temp = $wp_query; $wp_query= null;
$wp_query = new WP_Query(); $wp_query->query('posts_per_page=5' . '&paged='.$paged);
while ($wp_query->have_posts()) : $wp_query->the_post(); ?>

<h3 class="ostpPostTitle"><a href="<?php the_permalink(); ?>" title="Read more"><?php the_title(); ?></a></h3>
<p class="postDate">Posted on: <span> <?php the_time( get_option( 'date_format' ) ); ?></span></p>
<?php the_excerpt(); ?>

<?php endwhile; ?>

<?php if ($paged > 1) { ?>

<nav id="nav-posts">
    <?php wp_pagenavi(); ?>
</nav>

<?php } else { ?>

<nav id="nav-posts">
    <?php wp_pagenavi(); ?>
</nav>

<?php } ?>

<?php wp_reset_postdata(); ?>

Thank you in advance!


Solution

  • TO use wp_pagenavi() first you have to install the plugin "wp_pagenavi" you can install the plugin from here wp_pagenavi