Check out ThesisAwesome.com and get $20 OFF Product Skin Thesis Skins
How to add Page Navigation to Thesis Theme and CSS Style it using Thesis OpenHook and WP-PageNavi Plugins

How to add Page Navigation to Thesis Theme and CSS Style it using Thesis OpenHook and WP-PageNavi Plugins

by on January 21, 2010 · 73 comments

Thesis theme is one of the most exciting themes ever, I think this way about it because one thing rather than full controlling of your theme and design from inside your WordPress control panel and the other features included on it easy SEO for your blog, Thesis teach you and enhance your skills each time you tweak it.

I was trying today to add an easy page navigation to FamousBloggers blog, and I was thinking about using WP-PageNavi as it’s ready to use and all what we need is not install it and tell Thesis where to display it in our blog, then styling the way it looks is not a big deal. So let’s go through this three easy steps, but before that try to backup your code and database.

1 – Install WP-PageNavi plugin

Get WP-PageNavi plugin from it’s official website, and install it by the normal way like any other plugin, extract the zip file upload it to your plugin directory then check the plugin settings if needed. Note that after this step the page navigation may not show because Theses Theme doesn’t know about it yet! So we have to do a simple step to display it!

2- Tell Thesis where to display the page navigation

In most cases you will like to display the page navigation after the content section, and using Thesis OpenHook plugin is pretty easy thing. So you will need install Thesis OpenHook if your blog doesn’t have it.

After installing the plugin, open Theses OpenHook settings and scroll to “After Content” section, copy and past this code in the field as shown on the image below:

Thesis OpneHock

Thesis OpneHock

The code:

if(function_exists('wp_pagenavi')) { wp_pagenavi(); }
else { ?>
<div class="pagination">
<div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
<div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
</div>
<?php
     }

Don’t forget to tick the three check boxes under the field as shown in the image above where the green arrows to “Execute PHP on this hook”, “Remove Thesis post navigation ” and “Remove Thesis prev/next posts” (the third one is optional), I just didn’t style it yet, and I don’t like the way it show long titles of next and previous posts, I prefer one word or a small image!

3- Styling your page navigation

Here is the fun part, I have included the style code I am using here on FamousBloggers blog, you can change colors font size or any other elements to match your blog theme. Copy and past the code o your custom.css file to over ride the original style of the plugin, your page navigation will look like this: page_navigation

The code:

/*
-------- pagenavi-----------------------------------
*/
.wp-pagenavi { margin: 15px 0px 15px 0px; }
.wp-pagenavi a, .wp-pagenavi a:link { font-size:16px; padding: 5px 9px; margin: 2px; text-decoration: none; border: 1px solid #e1e1c8; color: #413f36; background-color: #eeeeee; }
.wp-pagenavi a:visited { font-size:16px; padding: 5px 9px; margin: 2px; text-decoration: none; border: 1px solid #e1e1c8; color: #413f36; background-color: #eeeeee; }
.wp-pagenavi a:hover { font-size:16px; border: 1px solid #608e7a; color: #FFF; background-color: #2ab7d9; }
.wp-pagenavi a:active { font-size:16px; padding: 5px 9px; margin: 2px; text-decoration: none; border: 1px solid #e1e1c8; color: #413f36; background-color: #eeeeee; }
.wp-pagenavi span.pages { font-size:16px; padding: 5px 9px; margin: 2px 2px 2px 2px; color: #000000; border: 1px solid #e1e1c8; color: #413f36; background-color: #eeeeee; }
.wp-pagenavi span.current { font-size:16px; padding: 5px 9px; margin: 2px; font-weight: bold; border: 1px solid #608e7a; color: #FFF; background-color: #2ab7d9; }
.wp-pagenavi span.extend { font-size:16px; padding: 5px 9px; margin: 2px; border: 1px solid #608e7a; color: #FFF; background-color: #2ab7d9; }

Don’t forget to clear your cash in case you are using WP Super Cache plugin to see the changes you have made.

That’s it!

Writing about Thesis is pleasure, I am thinking of having a series of post here talking about how to customize Thesis Theme. If you think Thesis need more posts from bloggers who have little experience like me then encourage me by adding a comment to this post.

Need fully customized Thesis Skins? Check out ThesisAwesome.com

Thesis_468x60

Article by Hesham Zebida

I create websites, and I develop Thesis Skins. I am a social network lover. I am also the night creature who works hard to keep this project up. Owner and founder of FamousBloggers.net.

Write for us a guest post

{ 58 comments… read them below or add one }

Mary November 30, 2011 at 11:32 pm

I do not know what I am doing wrong. I followed all of the instructions above and I still do not have a Nav bar showing. I have the pages selected, I have the plugins installed. I have Googled like crazy. I am not a Pro at this (obviously) and could use a little guidance.

Any help would be greatly appreciated!

Reply

Hesham Zebida December 1, 2011 at 1:09 am

I can see the navigation on your single post, probably you need to check the plugin settings!

Reply

D.J.Rony November 9, 2011 at 1:57 am

I tried the code with custom_function.php but it does nothing but an error in syntax. If I use it directly in custom_function file shouldn’t it work? i had to use the ftp to cleanup the code at last.
D.J.Rony recently posted..Google Hides Search Queries from WebmastersMy Profile

Reply

Hesham Zebida November 9, 2011 at 3:50 pm

Sorry, my code highlighting plugin was adding some extra comments to the code!

It’s fixed now!

Reply

Gouri July 16, 2011 at 12:21 pm

Thanks for sharing this.. How nice it would be if this was included in the customization option!
Gouri recently posted..WordPress Custom Permalinks Not Working? Here’s How to Fix ItMy Profile

Reply

Maria June 26, 2011 at 9:14 am

I am using page navi-plugin.. And its really frustrating. I have tried to change its style according to my theme. Can anybody suggest me any other good plugin?

Reply

Hesham June 26, 2011 at 1:14 pm

Hi Maria,

You might want to check “Paginator”, it’s the best navigation plugin for wordpress I’ve seen so far!

Reply

Nasif May 4, 2011 at 3:11 pm

I followed your tutorial and placed a page navigation link to my blog. The design is nice compared to the default one. Thanks for the post :)

Reply

kenedy April 27, 2011 at 2:01 pm

Hello, i have a problem with the pagination, it appears everywhere, in comments pages, on squezze pages… i just need it in the home posts page… how could I do that? Thankyou….
kenedy recently posted..A bit of youtube-How to Play Basic Piano Chords – Piano Fingering &amp the Musical Alphabet for Basic Piano ChordsMy Profile

Reply

Hesham April 27, 2011 at 2:18 pm

Hi Kenedy,

Check the plugin settings, there is an option to display the navigation on every page “Always Show Page Navigation”, make sure it’s not selected!

Reply

kenedy April 27, 2011 at 3:02 pm
kenedy April 21, 2011 at 2:12 pm

Hello, Thankyou for this pagination tutorial…
By the way, by default thesis insert the posts in a way that i don’t like. The first two, great, but the other ones appear in double column. I’m a newbie with thesis, how can I fix this? i need all the post the same like the first two. and just a page with 4 posts, then after that begin the pagination with page 2. I don’t want 7 posts all sqeuzzed together. I’m struggling with this, could you help me?
Thankyou in advance!

Reply

Hesham April 21, 2011 at 2:44 pm

Hi, I don’t understand your question perfectly but you maybe need to check your thesis design options, look for “Home Page Display Options” and change the numbers of featured posts or something!

Try to visit Thesis support forum, they have good support!

Reply

kenedy April 21, 2011 at 4:29 pm
Gustavo January 31, 2011 at 2:41 pm

How can I get rid of the page navigation on posts? For some reason the page navigation also appears also in posts. Is it supposed to?
Gustavo recently posted..How to Watch Live Sporting Events Free OnlineMy Profile

Reply

Hesham January 31, 2011 at 3:23 pm

I see, probably you need to set a condition to display it only on home page!

Have you tried Paginator plugin?

I think you are going to like it!

Reply

Gustavo February 1, 2011 at 1:15 pm

Yeah, I finally was able to fix it. I had to un check something I had selected.

What is the difference between pagenavi and paginator?
Gustavo recently posted..How to Watch Live Sporting Events Free OnlineMy Profile

Reply

Rohit January 26, 2011 at 7:18 am

Thanks buddy.. its working fine for me..
Rohit recently posted..New Working Free Activate 99 MobileNet gprs-3G plan in reliance gsm smart userMy Profile

Reply

Mike Pablate January 8, 2011 at 5:40 pm

Thanks for telling info on Thesis, as I’m new to Wordpress, so I just use simple plug-ins and themes to do blogging.

When I started my first website about “home data entry jobs” that time I was not aware of Wordpress but by visiting Wordpress forums I learned a lot and I also have to learn more to share here.

What I mainly use is site-map plug-ins, contact forum plug-ins and latest posts plugs etc…
Mike Pablate recently posted..Benefit of Forum Link BuildingMy Profile

Reply

Hesham January 23, 2011 at 3:31 pm

WordPress is the king CMS for blogging!

Reply

Mohzy December 12, 2010 at 6:18 pm

It works but how i remove “← Previous Entries” from my blog ?

Reply

Hesham January 23, 2011 at 3:30 pm

Hi Mohzy ,

Sorry for the very late reply!

To remove the previous entries from thesis skin, you can add this code to your custom-function.php :


remove_action('thesis_hook_after_content', 'thesis_post_navigation');

Reply

Thu Nguyen June 18, 2010 at 8:34 am

Thanks so much for this. I knew that Lester’s plugins are great but in integrating it into Thesis, well I haven’t yet mastered my hooks. So this is a godsend. Appreciate the help, Hesham!
Thu Nguyen recently posted..Are You Considerate of Others? Learn the Power of Pausing and You’ll Understand How It Can HelpMy Profile

Reply

Drahen June 12, 2010 at 10:41 pm

Thank you for this information, I though pagenavi automatically add this after content, just like sexybookmarks do. I don’t know that I had to manually add it. Thanks.

Reply

Hesham June 12, 2010 at 10:44 pm

Great to see it working for you, I have just visited your blog now.. enjoy!

Reply

David Osajie June 5, 2010 at 6:25 am

Thanks for this, worked like a charm. Though I’m yet to edit the css to fit the color of my blog, I think I’ll just keep using it that way.
David Osajie recently posted..3 Simple Ways to Fund Your Payoneer Debit MastercardMy Profile

Reply

Hesham June 5, 2010 at 6:28 am

It’s actually a great plugin, glad you like it and it worked for you!

Reply

element321 from evolutionary designs
Twitter:
April 15, 2010 at 5:32 pm

Hey buddy thanks for code. I just installed the plugin and added the code. It looks sorta like your page nav but not exactly. I will have to recode it to work better with my theme but overall it looks like a good starting point.
.-= NEW from element321 @ evolutionary designs´s last blog ..Daily Delicious Links April 8th 2010 =-.

Reply

Hesham April 15, 2010 at 5:53 pm

Check also the other page navigation plugin for WordPress I have posted about it recently, it’s much much easier to work with and have a feature to scroll through all pages!

Reply

Tony M February 24, 2010 at 11:32 pm

Im having troubles with this plugin, there is some padding in between each page # box that I can’t seem to remove. The darn menu is spreading across the whole theme and then dropping down, yet I only have 6 page numbers. Any ideas?
.-= Tony M´s last blog ..Top Notch Fitness Website Design Advice =-.

Reply

element321
Twitter:
April 15, 2010 at 5:37 pm

I know its a little late and you have probabally fixed it or moved on to something else. Have you tried using Hesham’s code? I had a lot of issue the standard CSS until I used his code. Now all I have to do is update it and change so it works better with my blog.
.-= NEW from element321´s last blog ..Daily Delicious Links April 8th 2010 =-.

Reply

Hesham April 15, 2010 at 5:44 pm

Thanks for your support buddy!

Reply

Hesham April 15, 2010 at 5:44 pm

I am sorry for the late respond Tony,

I see that you have solved the problem, you juts need to check the size of font in you CSS, it’s changing when I hover!

Also there is a post on the main page talking about another page navigation for WordPress that you can use, it’s the same I am using right now!

Reply

Tony M from Fitness Website Design April 15, 2010 at 8:51 pm

Thanks for the response Hesham. I fixed the code by aligning the css to conform to full page width with the Thesis theme.

What browser are you using to get a font error? I look and I see the hovered box enlarge, but not the font.
.-= NEW from Tony M @Fitness Website Design´s last blog ..How to Embed Videos on Wordpress Fitness Blogs =-.

Reply

Hesham April 15, 2010 at 10:46 pm

Chrome and Firefox!

It’s not an error by the meaning,and maybe it’s not a font size, but there is a little difference between 2 values, it makes a little shift when you move over the page numbers!…

Ok, I find it..

insted of .wp-pagenavi a:hover {
background-color:#EEEEEE;
border:4px solid #1A317F;

I think it should be

.wp-pagenavi a:hover {
background-color:#1A317F;
border:1px solid #1A317F;

This to avoid this little shift! tell if it work because I am not sure!

Reply

Tony M from Fitness Website Design April 16, 2010 at 3:13 pm

Thats how I wanted it, is there a reason I shouldn’t do that?
.-= NEW from Tony M @ Fitness Website Design´s last blog ..How to Embed Videos on Wordpress Fitness Blogs =-.

Reply

Hesham April 16, 2010 at 3:25 pm

Nope ;)

Reply

Praveen February 16, 2010 at 4:50 pm

Hi,
Thanks for this tutorial.
I am having problems setting this up on my blog.
I am using Thesis theme with Blogussion skin.
Below is a link to an image describing my problem.
http://www.watchmissedtvshowsonline.com/images/sample.jpg
I don’t know why but I am getting huge gap between the page numbers.
Please help me solve this problem.
Thank you.
.-= Praveen´s last blog ..24 Season 08 Episode 06 Day 8: 9:00P.M. to 10:00P.M. =-.

Reply

Hesham February 16, 2010 at 5:43 pm

I see! this is probably because your plugin is set to show lower number of pages! it’s set to show 5 pages!

Fix this problem by visiting the settings > PageNavi > and set it to show 9 or 10 pages or something!

Reply

Praveen February 17, 2010 at 1:05 am

Thanks for that.
Even after I set the number of pages to show to 9 in the pagenavi options, I am still out of luck.
Have a look at it now.
http://www.watchmissedtvshowsonline.com/images/sample1.jpg
I have followed your tutorial doing all the steps for several times, still no luck on my side.
Does blogussion skin has got any thing to do with this?
.-= Praveen´s last blog ..24 Season 08 Episode 06 Day 8: 9:00P.M. to 10:00P.M. =-.

Reply

Hesham February 17, 2010 at 1:34 am

The problem seem to be in this code in your custom.css file, this code apply on the page navigation some how!

.post_box, .teasers_box, .full_width #content_box .page {
margin:0 2.3em 0 1.1em;
}

Probably you can add this code right after the above code:
.page {margin:0 0 0 0;}

So maybe you will discover what exactly to change!

Reply

Praveen February 17, 2010 at 4:35 am

Thank you.
Looked into the code and edited as you told. Works like a charm now.
.-= Praveen´s last blog ..24 Season 08 Episode 06 Day 8: 9:00P.M. to 10:00P.M. =-.

Reply

Dennis Edell January 23, 2010 at 11:51 am

I feel so left out of these tutorials. lol. They give me good ideas of what I may want on my non-thesis themes though. :)
.-= Dennis Edell´s last blog ..Blog Move Is Imminent ! I’m Looking For Launch Partners… =-.

Reply

Hesham February 7, 2010 at 1:51 am

LOL! good it’s actually working on any theme!

Reply

Dennis Edell February 7, 2010 at 1:34 pm
Jimi Jonesjim January 22, 2010 at 7:00 am

This is very nice, thank you for sharing, Hesham.
.-= Jimi Jonesjim´s last blog ..Computer Glitches – Weirdness in Wonderland =-.

Reply

Jimi Jones January 22, 2010 at 7:05 am

Pardon the typo ;-)
.-= Jimi Jones´s last blog ..Computer Glitches – Weirdness in Wonderland =-.

Reply

Hesham January 22, 2010 at 2:38 pm

No problem, thanks Jimi!

Reply

Latief from AnotherBlogger
Twitter:
January 21, 2010 at 9:27 pm

Thanks for the sharing Hesham, sorry I’m not using Thesis Theme. I just curious, can I use this for my streamline theme? I don’t have page navigation yet, or there’s a plugin for the navigation?

Reply

Hesham January 22, 2010 at 2:36 pm

Yes! WP-PageNavi Plugin can be used on any blog!

Reply

JR from Internet Marketing
Twitter:
January 21, 2010 at 7:22 pm

The styling looks really nice Hesham, very neat and pretty.
.-= JR @ Internet Marketing´s last blog ..List of 128 Comment Luv Blogs by Niche =-.

Reply

lawmacs January 21, 2010 at 6:47 pm

Thanks for sharing this information hesham
.-= lawmacs´s last blog ..Guest Posting =-.

Reply

Michael Aulia from CravingTech.com
Twitter:
January 21, 2010 at 5:48 pm

I didn’t know about the Thesis OpenHook plug-in, I was using this manually on the custom_functions.php:

remove_action(‘thesis_hook_after_content’, ‘thesis_post_navigation’);

function custom_prev_next () {
if(function_exists(‘wp_pagenavi’)) {
echo ”;
wp_pagenavi();
echo ”;
}
}
add_action(‘thesis_hook_after_content’, ‘custom_prev_next’);
.-= Michael Aulia @CravingTech.com´s last blog ..Canon EOS 500D =-.

Reply

Michael Aulia from CravingTech.com
Twitter:
January 21, 2010 at 5:49 pm

Whoops..looks like the comment form doesn’t accept the copy-paste code correcty lol but you’ve got the idea
.-= Michael Aulia @CravingTech.com´s last blog ..Canon EOS 500D =-.

Reply

Hesham January 21, 2010 at 7:09 pm

I can read the code, and yes you are right, this is another way to do the same, I actually thought this at the beginning but I decided to make it more easy to let people think about what else they can do with the OpenHock plugin, you can imagine!

Reply

Michael Aulia
Twitter:
January 21, 2010 at 7:48 pm

True, true. Not many people like dealing with codes and manuals.
At least with the OpenHook plug-in, things will get a bit easier for them
.-= Michael Aulia´s last blog ..Canon EOS 500D =-.

Reply

Kristi Hines January 21, 2010 at 2:21 pm

I forgot about adding this back into my theme after I upgraded to Thesis… I just realized that I still have the Previous Entries link. Thanks for the post… I’ll have to go add that now.
.-= Kristi Hines´s last blog ..11 WordPress Plugins to Analyze and Increase Traffic =-.

Reply

mathan raj January 21, 2010 at 5:27 am

This plugin will really helpful for wp thesis users.
Thanks for sharing.

Reply

Leave a Comment

  Twitter (ID only. No links or "@" symbols)

CommentLuv badge

This blog uses premium CommentLuv which allows you to put your keywords with your name if you have had 3 approved comments. Use your real name and then @ your keywords (maximum of 3)

{ 15 trackbacks }