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 [...]
Posts
- Rick Triqui: my first PlayCrafter game
- Prototype of a Flash game like Meeblings
- Games for the game developers!
- The art of debugging
- How to embed a text file in Flash
- Create a Flash game in minutes with PlayCrafter
- Upgrade your Flash CS4 to 10.0.2
- Play Mazeroll, my latest Box2D game
- Triqui MochiAds Arcade plugin for WordPress Released!!
- The MochiAds funnel
- Flash game creation tutorial - part 1
- Create a Lightbox effect only with CSS - no javascript needed
- Flash game creation tutorial - part 2
- Make a Flash game like Flash Element Tower Defense - Part 2
- Flash game creation tutorial - part 3
- Create a flash draw game like Line Rider or others - part 1
- Create a Flash Racing Game Tutorial
- Make a Flash game like Flash Element Tower Defense - Part 1
- Create a flash artillery game - step 1
- Create a flash draw game like Line Rider or others - part 5
- Flash game creation tutorial – part 5.2




(4.9 out of 5) - Flash game creation tutorial – part 3




(4.86 out of 5) - Creation of a platform game with Flash – step 2




(4.84 out of 5) - Create a survival horror game in Flash tutorial – part 1




(4.82 out of 5) - Create a flash artillery game – step 1




(4.82 out of 5) - Create a Flash Racing Game Tutorial




(4.8 out of 5) - Create a flash artillery game – step 2




(4.75 out of 5) - New tile based platform engine – part 6 – ladders




(4.74 out of 5) - Flash game creation tutorial – part 2




(4.73 out of 5) - The experiment – one year later




(4.7 out of 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!