"If you can get along with everyone and everyone loves you, then you don't stand for much. A person who stands his ground for his principles and won't compromise his integrity is not loved by everyone."
- Larry Winget
This post is quite similar to my previous post on how to add MooTabs to WordPress. I recently tested Tabber on my internet marketing blog and I find that it is better than MooTabs because it is compact in file size, easier to install and customize.
The default Tabber look and feel is acceptable. I did not need to make a lot of changes to make it look good on my web site. Compared to MooTabs, Tabber requires a lot less work to customize.
Step 1: Download Tabber
Go to Tabber’s web site and download the latest version of Tabber.
Step 2: Upload Tabber to Your WordPress Theme’s Folder
I like to store my Javascript files in a folder called “js”. For my CSS files, I like to store them in a folder called “css”. Let’s assume my template folder is called “cooltemplate”, you should upload the Tabber files in the following manner:
1. /wp-content/themes/cooltemplate/css – Upload example.css here. Alternatively, copy and paste all the contents of example.css into your theme’s style.css.
2. /wp-content/themes/cooltemplate/js – Upload tabber.js here.
Step 3: Add Tabber References to Your WordPress Theme’s header.php
Add the following code to your theme’s header.php file in between the head tags.
1 2 | <script type="text/javascript" src="%3C?php%20echo%20bloginfo%28%27template_directory%27%29;%20?%3E/js/tabber.js"></script>
<script type="text/javascript">document.write('<style type="text/css">.tabber { display: none; }<\/style>');</script> |
If you only display Tabber on the blog pages, do this to prevent the loading of the Tabber files on non-blog pages.
1 2 | <script type="text/javascript" src="%3C?php%20echo%20bloginfo%28%27template_directory%27%29;%20?%3E/js/tabber.js"></script> <script type="text/javascript">document.write('<style type="text/css">.tabber { display: none; }<\/style>');</script> |
Step 4: Add Tabber Code into Your WordPress Theme’s sidebar.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | <div class="tabber">
<div class="tabbertab">
<h2>Tab 1</h2>
<p>Tab 1 content.</p>
</div>
<div class="tabbertab">
<h2>Tab 2</h2>
<p>Tab 2 content.</p>
</div>
<div class="tabbertab">
<h2>Tab 3</h2>
<p>Tab 3 content.</p>
</div>
</div> |
This is the default code of the Tabber. The text between the h2 tags will be displayed as the titles of each tab. You don’t have to display the content of each tab in the between the p tags. I did it with the HTML list tags.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <div class="tabber"> <div class="tabbertab"> <h2>Recent</h2> </div> <div class="tabbertab"> <h2>Popular</h2> </div> <div class="tabbertab"> <h2>Most Commented</h2> <ul></ul> </div> </div> |
The Tabber is a great place to insert all the comments and post lists. I personally use it to display the recent posts, popular posts, most commented posts, recent comments and top commenters.
Tagged As: Cascading Style Sheets, HTML, javascript, mootabs, Web design, WordPress
9 Comments On “How to Add Tabber to Your WordPress Theme”
On 8th January 2009 6:39 PM, Jared
said:
Hi,
Thank you for your tutorial. I am also integrating tabber on my wordpress site. I was wondering if you knew of a way to place posts and the comment template in two separate tabs on a single.php page. So it would look like the wall street journal site where they separate their tabs and articles by using tabs. I can get it to work only the comments don’t submit correctly. It it seems to have to do with the display:none in the css but I am not sure. Hope this is clear.
For an example of what I am going for see http://www.wsj.com
Thanks again.
Jared
On 9th January 2009 3:53 AM, Vincent
said:
I have done that on my other site:
http://www.vincentrich.com/
Check out the code on that site to find out how I did it.
On 10th January 2009 3:33 AM, Jared
said:
Hi,
I took a look at the site you sent. It looks really good and like the design but I can’t seem to see where the tabs have been implemented. Could you direct me with a more specific link? Sorry if I missed it.
Jared
On 12th January 2009 1:30 AM, Jared
said:
Hi,
I think there might have been a mis communication. I see that in your side bar you have implemented tabs. I have been able to do something similar. What I mean is having a single post in one tab and all the comments for that post in another tab. There must be a way to do this but I can’t seem to get it to work. Do you think that taking the comments.php page and copying it into the single.php will allow the comments to submit correctly. Thanks for your help.
Jared
On 13th January 2009 12:28 PM, Vincent
said:
Yes, you need to move the comments code into a tabber tab. Usually, the comments template is in the file comments.php.
If you want it displayed in the single.php file, you have a few solutions:
1. Create another template file, maybe call it comments-tabber.php and create the tabber code in this file.
2. Include the comments-tabber.php into your single.php where the current comments.php is.
On 13th January 2009 3:48 PM, Jared
said:
Thanks so much for your help. I will give it a try. Great websites and tutorials.
Jared
On 1st September 2009 1:16 PM, Brian
said:
ah great, looks like my comments disappeared after “logging in” with google connect.
I found Tabber by using the “Statement” wordpress theme, but am now using a new one. I’ve adapted Tabber to this new theme, but haven’t been able to figure out how to resize the Tabber “window”.
Any ideas?
On 16th November 2009 3:19 PM, syafwan
said:
Thanks, that is great.
On 13th February 2010 1:08 AM, neford
said:
Thanks for the post and tutorial I had no ideal about Tabber I will check it out
2 Trackbacks On “How to Add Tabber to Your WordPress Theme”
Post a Comment