BlueCapra

Using Technology To Solve Problems and Create Solutions

  • About Alan Reeves
  • Curiosity & Learning
  • Projects

Responsive Website Design – Making WP-PageNavi A Little More Responsive

August 31, 2013 by Alan R 2 Comments

Depending on how your website is built, chances are good that you have some sort of pagination; a way to scroll through your content page by page.  If you are using a plugin, like I am (WP-PageNavi), it might take a little help to be more responsive.

Recently, I was adding a widget in the sidebar of the site (if you are looking for more information on QR codes, check it out).  Since my theme (the Standard Theme by 8Bit) is responsive, I wanted to check to see what the widget looked like on my smart phone.  The widget looked fine but my pagination need a bit of help.  Here’s what it looked like on my laptop:

responsive-design-wp-pagenavi-before

And here is what it looked like on my iPhone:

responsive-design-wp-pagenavi-before-iphone

As you can see, the pagination on the iPhone is wrapping to the next line and my widget is all over the top.  So, first things first; let’s reduce the size of the pagination controls.

Adjusting the WP-PageNavi settings

Looking at the settings of WP-PageNavi, you can select how many pages to display and how many larger page numbers to display.  Initially, the plugin was set to display 5 pages and 3 larger page numbers.  With those settings, the navigation takes up pretty much the whole width of the content area.  Changing the settings to display 3 pages and 2 larger page numbers yields this on my laptop:

responsive-design-wp-pagenavi-middle

and this on an iPhone:

responsive-design-wp-pagenavi-middle-iphone

Good on a desktop, laptop, or tablet but no so good on an iPhone.  Luckily, having simplified navigation is a good thing for mobile devices.  WP-PageNavi does a great job adding CSS classes to each element so it’s pretty easy to change the look of things.  First off, I wanted to get rid of the dots (…).  That can easily be accomplished in the settings by clearing the field Text For Previous …

Slimming down the navigation for small screens

Step 2 was slimming down the navigation only for small screens (in my case, it is screens less than 600px wide).  Taking a look at the code, easy when you are using Chrome and choose Inspect element, you can see the elements that can be hidden.

responsive-design-wp-pagenavi-code

Adding a bit of CSS to the theme file in the right spot results in a few elements being hidden when viewed on small screens:

.wp-pagenavi a.page, span.extend, a.last {
 display: none;
 }

And here is the result (this is only a screen shot of the iPhone since the changes only affected small screens):

responsive-design-wp-pagenavi-result

For small devices, the only options available are to go forward or back one page.  The only additional items that is displayed are the current page and the total pages.  Much simpler navigation and layout, especially since it now looks and fits better.  All that from a few lines of code.

Apply this technique in other situations

Hiding items on pages can be helpful in a variety of situations.  In a past project, AutoMinder, I was able to display different fields when printing and when being viewed on a laptop.  That way, I could have the same page look completely different when printed with very little additional coding (and no new pages).

Well, that’s it.  Just a few lines of code and a little bit of experimentation resulted in a better site for visitors.  When was the last time you checked your site on a smart phone?  Is there something you can do to make your mobile visitors have a better experience?  Let me know in the comments below.

Filed Under: How-To

Comments

  1. Dave Reed says

    January 27, 2014 at 11:57 pm

    thanks for this tip, I’ve been wondering myself whether to stick with the plugin or switch over to something like Bootstrap (http://getbootstrap.com/components/#pagination) when it comes to mobile…

    Log in to Reply
    • Alan Reeves says

      January 28, 2014 at 8:42 am

      Thanks for the comment Dave. I think it is much simpler to have the same theme for every sized screen. Can’t imagine how difficult it would be to update 2 copies of a site but Bootstrap does look interesting. The right tool for the right job kind of thing.

      Log in to Reply

Leave a Reply Cancel reply

You must be logged in to post a comment.

Find what you are looking for

Books I've Read

48 Days to the Work You Love
Being Wrong: Adventures in the Margin of Error
How Doctors Think
The Art of Possibility: Transforming Professional and Personal Life
Dirty Rotten Strategies: How We Trick Ourselves and Others into Solving the Wrong Problems Precisely
Brainstorm: Harnessing the Power of Productive Obsessions
The Creative Habit: Learn It and Use It for Life
A Book of Five Rings: The Classic Guide to Strategy
Wild at Heart: Discovering the Secret of a Man's Soul
Reality Check: The Irreverent Guide to Outsmarting, Outmanaging, and Outmarketing Your Competition
Startup Guide to Guerrilla Marketing: A Simple Battle Plan For Boosting Profits
Vagabonding: An Uncommon Guide to the Art of Long-Term World Travel
Seeking Wisdom: From Darwin To Munger
Multiple Streams of Internet Income: How Ordinary People Make Extraordinary Money Online
Thomas Paine: Enlightenment, Revolution, and the Birth of Modern Nations
The War of Art: Break Through the Blocks & Win Your Inner Creative Battles
The 4-Hour Workweek: Escape 9-5, Live Anywhere, and Join the New Rich
Where Good Ideas Come From: The Natural History of Innovation
Moonwalking with Einstein: The Art and Science of Remembering Everything
Build Your Own Wicked Wordpress Themes


Alan Reeves's favorite books »

Copyright © 2026  ·  BlueCapra.com  ·  Built on the Genesis Framework and Centric child theme   ·  Affiliate Disclosure

Copyright © 2026 · Centric Theme on Genesis Framework · WordPress · Log in