Tabbed Widget Part Two

Tabbed Widget

Previously I wrote of my frustrations and desire to figure out tabbed widgets: Tabbed Widgets Part One. Funny that I had to struggle to find a way to display the code in a way that would not be parsed and or run by the blog engine. Hence the delay. However I found a plugin that suited me: iG:Syntax Hiliter. Don’t let the age of the plugin worry you, I run WordPress 2.9.2 – at the time or writing this – and it works.
You’ll also notice that I have extended the use of the tabs into the post footer where I show:

  • Author Information (yes you can guest post)
  • Related Posts
  • Top Posts in this category

This is how I did it

Script

  • Download the idTabs JavaScript file; currently there is version 2.2 and beta version 3.0.
  • Extract the script/s into your theme’s js folder

Add the call to the scripts in your Theme’s header.php file:
[js][/js]
Make sure that there is a call to load the jQuery core as well

either

[js][/js]

or

[js][/js]
PHP Calls

  • Obtain the plugins necessary to generate the lists that you may want to generate. The two lists I have are:
    • Top Posts. I made use of Popularity Contest, it has some great examples and the plugin itself produces some great information that can improve your blog.
    • Categories. I used the built in function wp_list_categories to list the categories without the heading:
      [php]
      [/php]

      Check out WordPress Codex for how you can further make use of wp_list_categories.

    • For random posts, I used the build in call:
      [php]

      [/php]

If you are wanting to add this as a widget and are also wanting to make use of php functions to generate lists then you will need to make use of a widget that can execute php code. The one that worked for me was phpCode. Add this widget to your sidebar.
HTML/PHP Code
Add the code that you need:

[html]

[/html]
CSS
[css].idTabs { margin:0;padding:0 0 10px 0;}
.idTabs ul { background:#000; padding:5px 0 0 5px; float:left; width:302px; }
.idTabs li { list-style:none; /*Try deleting this float*/ float:left; padding:0;}
.items li { list-style-type:square;}
.idTabs a { display:block; background:#000; color:snow; padding: 0 5px 0 5px!important; font:bold 12pt Arial; text-decoration:none; }
.items>div a { display:block; background:222; color:snow; padding: 2px 0 0 5px!important; font:10pt Arial; text-decoration:none; width:288px;border:none;}
.menu>div a { display:block; background:222; color:snow; padding: 2px 0 0 5px!important; font:10pt Arial; text-decoration:none; width:288px;border:none;}
.menu>div a:hover { display:block; background:#333; color:snow; padding: 2px 0 0 5px!important; font:10pt Arial; width:288px;border:none;text-decoration:underline;}
.idTabs a.selected { background:#FFF!important; color:#000!important; padding: 0 5px 0 5px!important}
.items>div { display:none; float:left; margin:0.1em 0 0 0.5em; color:#fff; background: #fff; margin: 0 0 15px; padding:5px;width:100%;}
.items>div a:hover{ color:#eee; background: #333;}
.items {padding: 0 0 5px 0;}
[/css]

Did this help you? Please let your peeps know and tell me what you think or if you have any other suggestions.
Also this was quite a learning curve for me. Let me know what you have learned lately
.


Related Articles:

9 Responses to “Tabbed Widget Part Two”

  1. Nate Pointer March 14, 2010 at 11:33 pm #

    Thanks for this post. I was having the same problem with WordPress and adding tabs. Very easy to setup and works great. Now I just have to style it to match the rest of my site. Just purchased StandardTheme and have been working on a redesign. Thanks again!
    .-= Nate Pointer´s last blog ..Sample Post =-.

  2. Nate Pointer March 14, 2010 at 11:46 pm #

    Thanks for this post. I was having the same problem with WordPress and adding tabs. Very easy to setup and works great. Now I just have to style it to match the rest of my site. Just purchased StandardTheme and have been working on a redesign. Thanks again!

  3. wholesale nfl jerseys August 3, 2010 at 4:14 am #

    Dear friends, thank you for visiting our website ,we are an international trade company,which specializes in NFL jerseys.We wholesale jerseys at competitive price,providing a huge range of cheap nfl jerseys of different teams,such as Arizona Cardinal,Atlanda Falcons ,Baltimore Ravens,etc.You can buy cheap jerseys. Welcome to visist here .

  4. Sam August 30, 2010 at 10:51 am #

    I appreciate you sharing this. Nevertheless, constantly hold an open mind. You’ll never know what may come up.

  5. Kaitlin Mazzetti January 2, 2011 at 1:23 pm #

    Kudos for this specific blog post, I will definitely add this website to my own rss feeds, a buddy basically informed me regarding this yesterday. this may be the greatest…

Trackbacks/Pingbacks:

  1. faith-based film - March 12, 2010

    Tabbed Widget Part Two: Previously I wrote of my frustrations and desire to figure out tabbed widge… http://bit.ly/9qO4lI
    (@phillipgibb)

  2. phillipgibb - March 13, 2010

    My Blog Post Tabbed Widget Part Two – Previously I wrote of my frustrations and desire to figure out tabbed widgets… http://ow.ly/16N1uS

  3. Алексей - March 17, 2010

    Хм

Leave a Reply:

Gravatar Image

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Spam Protection by WP-SpamFree Plugin

Performance Optimization WordPress Plugins by W3 EDGE