Adding tabs easily in your WordPress theme
When you are running a blog for some time, you will have more and more contents to display, and the same space where to make them fit.
That’s why a lot of latest WordPress themes feature tabbed navigation to save space.
This screenshot refers to Linoluna theme, but there are thousands more using this kind of navigation.

You can find various tutorials in the web explaining how to do it, but I am going to tell you what I made.
What’s the difference? I won’t give you cut/paste code, as in most cases it will only work in the themes the tutorials is referring.
I am going to tell you how I made the tabbed navigation showing recent, most popular and top rated posts.
I made my tabbed navigation with one thing in mind: lightweight.
So I discarded all framework-based tabbed navs and used DOMTab. Once I downloaded the last version, I only uploaded the main file, domtab.js, into my theme directory.
Then I changed header.php adding
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/domtab.js"></script>before </head> tag.
Now it’s time to change the sidebar… forget the examples full of <p> and <div>, I just added
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | <h2>Posts</h2> <div class ="domtab"> <ul class="domtabs"> <li><a href="#t1">Recent</a></li> <li><a href="#t2">Most popular</a></li> <li><a href="#t3">Top rated</a></li> </ul> <div> <a name="t1" id="t1"></a> <ul> <?php $recent = new WP_Query("showposts=10"); while($recent->have_posts()) : $recent->the_post();?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endwhile; ?> </ul> </div> <div> <a name="t2" id="t2"></a> <?php tpbc_list(); ?> </div> <div> <a name="t3" id="t3"></a> <ul><?php get_highest_rated('both',18,10); ?></ul> </div> </div> |
and then I just had to define some styles. Just remember not to change the domtab and domtabs class names, or it won’t work.
As for the styles, I did not upload the external CSS provided with the package, but just defined some styles to the new classes recently added.
And that’s it… see the result in my sidebar… now I am going to add some fancy icons and my lightweight tabbed navigation is done.
You will be pleasantly surprised by WordPress Themes provided by Template Monster. All of them are of professional design and high quality.
5 Responses to “Adding tabs easily in your WordPress theme”
Leave a Reply
Trackbacks
-
Adding tabs easily in your WordPress theme : Emanuele Feronato | thethemesecrets on
January 4th, 2009 2:46 am
[...] View post: Adding tabs easily in your WordPress theme : Emanuele Feronato [...]
- Get up to $100,000 for your next Flash game with Mochi GAME Developer Fund
- Create a dynamic content animated footer ad for your site in just 9 jQuery lines – 17 lines version
- Sell sitelocked version of your Flash games and even .fla sources to Free Online Games
- Protect your work from ActionScript code theft with SWF Protector
- Create a dynamic content animated footer ad for your site in just 9 jQuery lines
- Understanding Box2D’s one-way platforms, aka CLOUDS
- Triqui MochiAds Arcade plugin for WordPress upgraded to 1.2
- Box2D Flash game creation tutorial – part 2
- 11 Flash isometric engines you can use in your games
- Monetize your Flash games with GamesChart
- Create a Lightbox effect only with CSS - no javascript needed
- Flash game creation tutorial - part 1
- Create a Flash Racing Game Tutorial
- Flash game creation tutorial - part 2
- Make a Flash game like Flash Element Tower Defense - Part 2
- Flash game creation tutorial - part 3
- Make a Flash game like Flash Element Tower Defense - Part 1
- Create a flash draw game like Line Rider or others - part 1
- Triqui MochiAds Arcade plugin for WordPress official page
- Create a flash artillery game - step 1
- Flash game creation tutorial – part 5.2 (4.88/5)
- Create a flash artillery game – step 1 (4.79/5)
- Create a Flash Racing Game Tutorial (4.76/5)
- Create a flash artillery game – step 2 (4.74/5)
- Create a survival horror game in Flash tutorial – part 1 (4.73/5)
- Creation of a Flash arcade site using WordPress – step 2 (4.73/5)
- Flash game creation tutorial – part 2 (4.71/5)
- Flash game creation tutorial – part 1 (4.70/5)
- Create a flash draw game like Line Rider or others – part 1 (4.69/5)
- Creation of a platform game with Flash – step 2 (4.68/5)







Pretty great…
When do you plan to continue the survival horror tutorial?
It’s the 4th highest rated post in your blog in that list..
I found a bug…. (I think)
On my computer using Internet Explorer (newest version.
On your home page there are all the posts and for every post there is a small link that has the number of comments for the post. Like this:
“5 Comments”
That link will take you to the post and automaticly scroll down to the comments, right?
Well for me it dose that but after a couple of seconds all the content of the post (all of it) vanishes and the side bar simply pops to the middle.
lot of thanks for this wordpress tutorial Emanuele ! thankyou ! ! !
Da un po fastidio che cambia altezza durante il hover. Per il resto, molto bello!