• Home
  • About
  • Contact
  • Photo Gallery
  • Resume
  • Subscribe         Connect             
Blue Orange Green Pink Purple

Color Paper Ajax Tabs Fix

Posted in Code, WordPress. on Tuesday, March 10th, 2009 by Simon Tags: colorpaper, site, tech, theme, WordPress
Mar 10
 
Background

For the most part, I have been very happy with the Color Paper wordpress theme. As with anything free, there are usually a few gotchas. The broken ajax tabs were the only technical problem I’ve had with the theme thus far. Since I haven’t spoken with the author, I wasn’t sure what the initial intentions were for the ajax tabs.

It looks like the tabs can be setup to support true AJAX functionality. However, if you look into the sidebar.php file you’ll notice the theme itself includes the HTML contents directly within the initial response, rather than fetched with client side JavaScript via AJAX calls. For me, the additional overhead of loading all three tabs isn’t that bad, and therefore I have decided not to fully implement a true AJAX tab control.

With that said, the below steps will get your side bar tabs up and working in the Color Paper WordPress theme. Kudos to the author and Smashing Magazine for yet another great theme.

As with any javascript, you can choose to either include it in a separate file or directly within the HTML. For several reasons, I would recommend always including the majority of your javascript in an external, browser cacheable, file and reference it from your HTML.

Recommended Fix (external file)
  1. Download ajax.tabs javascript file.
  2. Upload the javascript file to your theme’s js folder (wp-content/themes/colorpaper/js).
  3. Include a reference to the javascript library in header.php as indicated below, or by other javascript include mechanism if installed, such as wp_js.
<script
     type="text/javascript"
     src="<?php bloginfo('template_directory');?>/js/ajax.tabs.js">
</script>
Quick Fix
  1. Copy the below javascript into header.php.
  2. <script language="JavaScript" type="text/js">
    jQuery(document).ready(function()
    {
            jQuery('ul.tabs a.tab').click(function() {
                   
                    jQuery('div#' + jQuery('ul.tabs a.active').attr('title')).toggle();
                    jQuery('ul.tabs a.active').toggleClass('active');
                                                   
                    jQuery(this).toggleClass('active');
                    jQuery('div#' + this.title).toggle();
                    return false; // cancel event bubble
            });
    });
    </script>
  3. That’s it.

Stay tuned over the next few days for another Color Paper theme enhancement guaranteed to increase page load times and improve the overall user experience of your site.Hint: large images.

Drop me a line if you have any questions or problems implementing the fix.

Share and Enjoy:
  • Print this article!
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • BlinkList
  • blogmarks
  • E-mail this story to a friend!
  • Netvibes
  • Reddit
  • RSS
  • StumbleUpon
  • Technorati
Survivor No More
Yes, I'm a survivor fan. Will I ever watch it again? No! That's it. After the most recent vote I cannot understand how Sandra by any means outplayed her competitors. Seriously, either P or R totally deserved to win. They need to rethink the final vote, because it totally isn't fair!!!!!!!!!!!!!!…
My hResume Plugin
Ever find it difficult to keep your resume up to date? Look no further. I have taken the hResume WordPress plugin and added all the bells and whistles needed to create an interactive online resume, complete with PDF generation. Read entire article
iPhone 3.0 Has a Use

Yes, I know iPhone 3.0 was released several weeks ago, it's not late breaking news anymore. Well, I'm not here to post about up-to-the minue product releases, but more just my personal experiences with them. See the post for my son's version of "Take me out to the ball game" as recorded on the iPhone Read entire article

9 Comments

  1. daniel on June 29th, 2009

    Hey Wosko.

    I see the tabs are working on your site. It looks great and the function is excellent aswell. I just can’t get it to work on my sisters blog.

    I read your instructions did what you wrote. I’ve been sitting some hours now trying to get it to work.
    Any other tips you give me?

  2. Simon on June 29th, 2009

    Hi Daniel,

    To be honest, it depends much upon the environment (I know that’s the easy way out). Are there any javascript errors on the page? Is the script making it to the page and not being interrupted by other widgets you may have installed. The key is figuring out where the problem is actually happening.

    A reference point, aka a URL were you’re trying to implement said tabs, would be most beneficial in resolving the issue. I would be happy to take a quick look if you can provide a link to the blog.

  3. stOrM! on July 6th, 2009

    Same here I’ve tried every single step as descripted above but no luck!
    Maybe its a problem because of running wp 2.8???
    Well any suggestions ouwld be nice maybe you can show on which line you have inserted your fix inside of header.php?

    Other then that, great article!

    kindest regards
    s!

  4. Simon on July 7th, 2009

    Maybe its a problem because of running wp 2.8???

    The version of wordpress shouldn’t be the issue in this situation. I have upgraded my development edition to version 2.8 and the tabs are still working.

    My guess is you have led me to the culprit (which line the script is included on). The ajax.tabs.js include must be after the jquery include. I guess before that, jquery must also be included (typically is in most installs of the template).

    In my header.php I have included the script on line 8:

    <script type=”text/javascript” src=”<?php bloginfo(’template_directory’); ?>/js/jquery-1.2.6.min.js”>
    <script type=”text/javascript” src=”<?php bloginfo(’template_directory’); ?>/js/jquery.jcarousel.pack.js”>
    <script type=”text/javascript” src=”<?php bloginfo(’template_directory’); ?>/js/ajax.tabs.js”>

    If the above does not help, let me know the URL and I would be happy to take a look for you. Thanks for reading and happy blogging!

  5. stOrM! on July 11th, 2009

    Hello again,
    thank you for explaining on which line to add the script what shoud I say again, no luck making it work!
    Another Idea, the second script you mentioned in your post is on the wrong line in the header.php perhaps?
    Maybe you can drop me a mail if you like because my blog is still private so I don’t wanna post the adress here in the moment but via mail if you like we can figure things out more deeply? Would be really nice since I really like that theme but really need the tabs thing working now :-)

    kindest regards
    s!

  6. stOrM! on July 11th, 2009

    Again its me so sorry that I asked so much!
    But I made the Tabs working now on my blog this was by accident! :-)

    I didn’t not knew at least I didnt seen it mentioned that i need to use the Text widget to make them display’d!
    While wathing your sites code I noticed something like:

    Categories
    Tags
    Archives

    <a href=…………………………………

    What I wonder now due to the problem that I dont knew web programming at all, how can i fill the Tabs with dynamically content now?
    So that under the Categorys tab all categorys from my Site are display’d automatically or do i need to hardcode them into the tabs?

    Can you show me please how to do that? I basically need the same tabs as you have on your site!

    kindest regards
    s!

  7. Simon on July 11th, 2009

    S: glad to see you got the tabs working. Once you go live with your site, please do post a link as I’d like to see another implementation of the Color Paper theme in use.

    As for populating the tabs, I used the built in wp functions in my theme file. You can definitely replace these functions with whatever you’d like to include in the tabs, i.e., recent comments (< ?php get_comments($comments_limit); ?>), popular posts (< ?php get_popular($popular_limit); ?>), featured (< ?php get_featured($featured_cat); ?>) and more.

    Here are the entire contents of the tab section in my sidebar theme file. You can edit this file directly, or do so using the Theme editor in the WordPress admin area (Admin > Appearance > Editor > Select sidebar).

    <li class=”tabwrapper”>
    <ul class=”tabs clearfix”>
    <li><a href=”#” title=”content_1″ class=”tab active”>Categories</a></li>
    <li><a href=”#” title=”content_2″ class=”tab”>Tags</a></li>
    <li><a href=”#” title=”content_3″ class=”tab”>Archives</a></li>
    </ul>
    <div id=”tabs”>
    <div id=”content_1″ class=”content”>
    <ul id=”popular”>
    <?php wp_list_categories(’title_li=’); ?>
    </ul>
    </div>
    <div id=”content_2″ class=”content”>
    <ul id=”comments”>
    <?php wp_tag_cloud(’smallest=8&largest=16&order=ASC&’); ?>
    </ul>
    </div>
    <div id=”content_3″ class=”content”>
    <ul id=”featureded”>
    <?php wp_get_archives(’type=monthly’); ?>
    </ul>
    </div>
    </div>
    </li>

    Hope this helps. Good luck and happy blogging.

  8. stOrM! on July 12th, 2009

    Sorry but its getting an endless problem here…
    As you descripted I inserted your code into my sidebar.php what should I say? No Tabs anymore no error message nothing….
    Btw. I inserted your code at line: 48 in the sidebar.php directly under:

    They where acutally code which was involved with tabs but I guess that was the old original code in sidebar.php so I removed it and replaced it with your code above…

    Maybe you send me your sidebar.php directly? Or I can send you mine?
    regards
    s!

  9. rhinorck on April 12th, 2010

    worked like a charm, will post the link when I go live. thanks



Leave a Reply

Personal blog of Simon Wosko
    • Categories
    • Tags
    • Archives
    • Code
    • Gadgets
    • Personal
    • Uncategorized
    • Web Site
    • WordPress
      colorpaper family Gadgets iphone pics plugin site tech theme WordPress
    • May 2010
    • August 2009
    • July 2009
    • March 2009
    • February 2009
  • Pixxlz - print smart
    LinkShare  Referral  Program
     
  • Me Around the Web
    • 2/6/12
    • Facebook Syndication Error
    • 2/3/12
    • Geek, Gamer and WOW T-shirts and Gadgets - Bytelove Inc
    • 1/30/12
    • phonegap/phonegap-plugins - GitHub
    • Backbone.js
    • Backbone.js
    • Humans TXT: We Are People, Not Machines.
    • Light Bulbs | Christmas Lighting | Rope Lights | Halogens | LED | 1000Bulbs.com
    • kirchmann_fig01b.gif (400×358)
    • 1/27/12
    • Polish contribution to World War II - Wikipedia, the free encyclopedia
    • 1/23/12
    • Neighborhoods
    • 1/5/12
    • How to make a grow box controller
    • 9/15/10
    • Melissa (Live 2007) by Dave Matthews Band
    • 9/14/10
    • What's A Boy To Do by Mat Kearney
    • 7/10/10
    • I'm Yours (Live On Earth Version) by Jason Mraz
    • 7/4/10
    • Loving Wings (Live) by Dave Matthews & Tim Reynolds
    • 5/24/10
    • swosko: It's flyers time. Bring on da Hawks!
    • 5/14/10
    • swosko: #flyers are inspiration to the entire city. We can all overcome anything if we work hard at it! Let's go Flyers!
    • 5/11/10
    • State Radio – The Diner Song
    • 99 Red Balloons (Live) by 7 Seconds
    • 3/1/10
    • Young Forever by Jay-Z
    • 1/21/10
    • Hostile Gospel, Pt. 1 (Deliver Us) by Talib Kweli
    • 11/11/09
    • Stay by Back Door Slam
    • 7/18/09
    • swosko: Hershey is great, well minus the hour long lines. Still a good time though. Time for some chocolate from the factory.
    • 7/14/09
    • swosko: Found a use for the iPhone 3.0 voice recorder http://bit.ly/P2Gjg
    • 7/9/09
    • swosko: Is enjoying a day without commuting on 76. Now if I could just get around 202.
    • 7/4/09
    • swosko: Successful fourth - big wheel races, carnival games and a healthy dose of fireworks.
    • 6/22/09
    • swosko: not in marketing but come on "now topped with real fruit" - really, "real" fruit, sounds so good (yo quiero taco bell)
    • 5/30/09
    • Boys In The Back Room by Chuck Brodsky
    • 5/15/09
    • swosko: Is excited to see Google Squared in action
    • 5/2/09
    • swosko: Pleasantly suprised by Wegman's sushi. Mm spicy tuna.
    • 4/16/09
    • swosko: 30 days and counting till this Hedge Fund reporting project is over - the beauty of consulting.
    • 4/15/09
    • The Idea Of You (Live 2006) by Dave Matthews Band
    • swosko: Back on the twitter wagon. Let's go Flyers!
    • 4/8/09
    • We're Going To Be Friends by Jack Johnson
    • 3/11/09
    • Sunday Morning Coming Down by Me First &The Gimme Gimmes
    • 3/5/09
    • Kate Is Great by The Bouncing Souls
    • 2/24/09
    • I'm Yours by Jason Mraz
    • Steal My Kisses by Ben Harper
    • Breakdown (feat. Jack Johnson) by Handsome Boy Modeling School
    • 2/13/09
    • Blacklist by The Briggs
    • 1/12/09
    • Recently (Live) by The Dave Matthews Band
    • 1/7/09
    • Old School Rules (feat. Talib Kweli) by Danger Doom
    • 1/6/09
    • Hip Hop by Dead Prez
    • 12/12/08
    • Howie Day – Numbness For Sound
    • Jimmy Eat World – Call It In The Air
    • The Allman Brothers Band – Midnight Rider
    • Maroon 5 – This Love
    • Oasis – Cast No Shadow
    • Death Cab for Cutie – Steadier Footing
    • Radiohead – Bones
    • Muse – Fillip
    • Gorillaz – Monkey Racket (Man Research)
    • 10/9/08
    • I Can by Nas
    • swosko: Preparing to listen to the wise words of one of our certified SCRUM coaches.
    • 10/2/08
    • swosko: Still getting over the high from just watching the phils kick butt at citizen's bank park. Amazing.
    • 9/27/08
    • swosko: Kickin' it with Kieran and the Lil' Kickers
    • 9/24/08
    • swosko: Nice change of pace - migration during normal business hours.
    • 9/15/08
    • swosko: Thoroughly enjoying the game.
    • 9/11/08
    • swosko: Can't believe people still use VBA
    • 9/5/08
    • After Tonight by Justin Nozuka
  • Recent Articles
    • Survivor No More
    • My hResume Plugin
    • iPhone 3.0 Has a Use
    • Springtime 2009 Photos
    • Color Paper Ajax Tabs Fix
    • Wosko.us Launch Party
  • Search


  • Subscribe

    Are you more comfortable receiving updates via email? No problem! Use the below form to receive email updates.

    Enter your email address:

    Delivered by FeedBurner


  • Powered by 1 & 1 Shared Hosting

    Custom built Content Delivery Network Powered by Google App Engine

  • Home
  • About
  • Contact
  • Photo Gallery
  • Resume

© Copyright Wosko.us: Personal blog of Simon Wosko. All rights reserved.
Designed by FTL Wordpress Themes brought to you by Smashing Magazine

Back to Top