May
15

Talk it out

Last night I finally cracked a substantial issue I’ve had with the storefront on my company’s website: it didn’t work.

Jumping Duck Media’s website uses two fantastic third-party features, the Featured Content Gallery plug-in and the WP E-Commerce plug-in.  Both of these plug-ins add special functionality to the content management system I use to run the website.  The Featured Content gallery runs the fancy animated display on the front page.  The E-Commerce plug-in runs, obviously, the store.  Unfortunately for me (and several others), the two plug-ins don’t play nice together.

For the past few months I’ve been struggling to find an alternative.  I really want to use both and, in isolation, had them completely customized to my needs.  The downside is that they don’t interact and crash the website.  I’ve spent countless hours on Google trying to track down a fix.  Yeah, there wasn’t one.

Last night, though, I finally threw up my hands and gave up.  I try to avoid techno-talk with my friends and family, but I was frustrated and needed to vent.  I explained everything to my mother – which forced me to detail everything because she’s not a web developer.  Over the course of the conversation, I suddenly realized how to fix the problem!  (For those of you interested in the exact fix, click “read more” below)

Too many times in business we internalize our problems.  A sense of pride convinces us to keep our struggles quiet and decline help until the world comes crashing down.  We’ll sit and stare at a problem for hours, grasping at a solution.  Ironically, just taking a few minutes to talk the solution out with an interested and unbiased third party will force us to think about the problem in a new way.  It’s this conversation that can turn hours of “maybe this way … no, that won’t work … maybe this” into “viola!  I’ve got it!”

How often do you let a problem simmer for two long?  Do you have a trusted friend you can go to?  Not for advice or help, but just to serve as a sounding board while you talk out loud?  If you don’t, I recommend you find one!

Warning – Techno-babble ahead!

OK, now the details to the solution.  The problem most of us face while trying to integrate these two plug-ins is a Javascript conflict.  You can’t instantiate both plug-ins simultaneously because they depend on some of the same object definitions and interfere with one another.  In WordPress, the fix is remarkably simple!

First, you need to add a new hook to your theme’s header file.

Both plug-ins hook into the ‘wp_head’ action that your theme calls in the <head> section of the page.  This calls up the relevant Javascript libraries and starts up each system.  Hooking both functions into ‘wp_head’ is where the problem occurs, though.  So we need to create a second header action hook.

Immediately after the tag <?php wp_head(); ?> we need to add the following code:

<?php if(is_front_page()) do_action(‘jdm_head’); ?>

This code will check to see if you’re on the site’s front page (I assume you’re using the Featured Content Gallery on the front page here).  If you are, then it creates an additional hook called ‘jdm_head.’  If you aren’t, then nothing happens.

Second, you need to tie the Featured Content Gallery to this new hook.

At the bottom of the plug-in’s main file (content-gallery.php) you’ll find the code to hook the plug-in’s functions to WordPress.  You’re looking for the following line:

add_action(‘wp_head’, ‘gallery_styles’);

Which you need to change to:

add_action(‘jdm_head‘, ‘gallery_styles’);

And now, without further adieu, reload the front page of your website.  These two changes will make the plug-ins compatible and allow you to reap the benefits of using both systems at the same time!

A few warnings, though:

  1. This fix is specific to version 3.6.12 of the E-Commerce plug-in and version 3.2.0 of the Featured Content Gallery
  2. You can’t use both the plug-ins on the same page.  So no featured gallery on the storefront
  3. Automatic updates to the Featured Content Gallery will overwrite the change you’ve just made

Aside from that, things should work just fine for you from here on out.  Feel free to see how it works on my other site if you don’t believe me: Jumping Duck Media Storefront.

Good luck!

Comments

  1. Colin says:

    Thank you so much for this solution!!
    Saved me a lot of time.

    Great little write up about how talking things out really helps. It really does get the brain juices flowing.

    Thanks!

  2. Chris says:

    Really good article, thanks. Having an issue with the FCG and a dropdown menu. Still haven’t got a fix for it, but I’m going to talk to my mother about it :)

Speak Your Mind

*