Easily add Wp-PageNavi to Twenty Eleven

Adding Wp-PageNavi plugin to Twenty Eleven is a bit different than adding it to Twenty ten. The code must be placed into functions.php instead of the loop.

This code will only work with a child theme, you’ll have to modify it to add it straight to Twenty Eleven, but why would you want to do that anyways?

Old Way – no need to do it this way anymore
Open functions.php and add

As David pointed out there is now no need to create a custom function anymore, the same function name can be used, so we’ll use this instead.

We can skip this template modification step now since we’re using the default function name and go ahead and get right to adding the CSS.
Next copy index.php from Twenty Eleven to your child theme folder and open it. Find this line

Change that line to this

Save and upload both files, activate Wp-PageNavi and view your site. If it’s not installed, it will display the default pagination. The reason I wanted to do it this way, was to give users a choice to use Wp-PageNavi or not.

Here’s a bit of css you can add to your stylesheet if you like how I’ve styled mine, replace “orange” to change the color.

Download Modified Files as a child theme

27 thoughts on “Easily add Wp-PageNavi to Twenty Eleven

  1. I want to put a pagination on twenty eleven theme. I followed the instructions, but it was still not working for me, can someone help me plz. Thank you.

  2. This solution placed the nav at top and bottom of index page. I only want it on the bottom. Thoughts?

    1. It displays page navi wherever Twenty Eleven displays page nativagtion. If you don’t want it to display in a certain area, you can use display: none; in your CSS to hide it.

  3. Could you please help me. I’m trying to add the WP PageNavi to my WP-Zoom Theme. For single posts. Where would I need to add this code.

    1. Hi Jared, Wp-PageNavi has instructions for adding it to themes. This post will only work with Twenty Eleven. I’m not familiar with your theme, so it’s hard for me to answer your question. Usually single.php handles single posts though.

      You’ll need to find where in that template the call for the next and previous links are at, then replace them with

      Also read here for more instructions http://wordpress.org/extend/plugins/wp-pagenavi/installation/

Leave a Reply - Use <pre>YOUR CODE</pre> when posting code.