How to Add PageNavi to Twenty Eleven WordPress Theme ?

WordPress is no doubt-a fast-growing content management system (CMS). Many of us use this to make stylish dynamic websites.

In my previous posts, I have explained well about twenty eleven WordPress theme features, like to add modify sidebar, to make a change in fonts and also some useful plugins.

In today’s post, I will explain to add pagenavi to your blog/website, this will not only increase the look of your blog but also give ease to its valuable readers.

Read Also:

How to Add PageNavi to Twenty Eleven WordPress Theme:

First of all download Wp-PageNavi Plugin and activate it
Go to admin > Appearance   > Editor > Function.php file
Find the following code

function twentyeleven_content_nav( $nav_id ) {
    global $wp_query;

    if ( $wp_query->max_num_pages > 1 ) : ?>
        <nav id="<?php echo $nav_id; ?>">
            <h3 class="assistive-text"><?php _e( 'Post navigation', 'twentyeleven' ); ?></h3>
            <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentyeleven' ) ); ?></div>
            <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) ); ?></div>
        </nav><!-- #nav-above -->
    <?php endif;
}

Replace it with this code

function twentyeleven_content_nav( $nav_id ) {
global $wp_query;

if ( $wp_query->max_num_pages > 1 ) : ?>
<nav id="<?php echo $nav_id; ?>">
<h3 class="assistive-text"><?php _e( 'Post navigation', 'twentyeleven' ); ?></h3>
<br>
<?php wp_pagenavi(); ?>
</nav><!-- #nav-above -->
<?php endif;
}

That’s all the plugin will work perfectly, you can see its action at the bottom of your post.

If you want to make it stylish then click installed plugin > Edit wp-pagnavi plugin > find the CSS file, make changes and enjoy.

You can observe the page Navi of my page here.

add pagenavi to wordpress theme
Although, many WordPress themes have builtin options of adding features like above still this post will help to understand the theme of adding page Navi to your WordPress theme.

2 thoughts on “How to Add PageNavi to Twenty Eleven WordPress Theme ?”

  1. Nice blog right here! Additionally your website quite a bit up very fast!

    What host are you the use of? Can I get your associate hyperlink to your host?
    I desire my website loaded up as fast as yours lol

    Reply

Leave a Comment