Stuff in the ‘javascript’ Category

Realto Theme Plus dsIDXpress Plugin Results in Double Thumbnails

Friday, October 16th, 2015

We were recently approached by a client who was having a problem with a site they were building. They are using the Realto theme, plus the dsIDXpress plugin.

The site was experiencing double / duplicate thumbnails for the home slideshow, which is clearly a problem, especially since it caused the thumbs to not correspond to the correct slide.

Through some troubleshooting, we discovered that both the plugin and the theme are loading the jquery files for the Cycle2 slideshow. With two scripts running on the same slideshow, it caused this duplicate behavior. The solution was clear: remove one of the two scripts from being loaded.

Possible solutions included:
1. Removing / Commenting out the code that loads the script in the IDX plugin. (Bad plan, because the next time the plugin is updated, the code will re-appear, and the problem will happen again).
2. Removing/ Commenting out the code that loads the script in the Realto theme. (Also a bad plan, but less so than #1, since themes usually get updated less frequently than plugins).
3. Write a plugin to de-enqueue the script. This is viable and clean, but not ideal (more work, plus another plugin in the system).
4. Fortunately, the client was using a Child Theme, so we were able to use this clean / viable solution, without adding more plugins: de-enqueue the script in the Child Theme’s function file. (This would not have been possible if the client was not using a child theme).

For reference, here’s the code that we simply added to the child theme’s functions.php file:

add_action('wp_print_scripts', 'realto_cleanup_scripts');

function realto_cleanup_scripts() {
	 wp_dequeue_script( 'nt-jquery.cycle2.min' );
}

If you needed to make this a plugin, it would actually be a simple matter. Create a new file (no need to put it in a folder), title the file something like “realto-dequeue-script.php”, and add the below code to the file. Drop it into the wp-content/plugins folder, activate the plugin, and voila!

/*
Plugin Name: Realto Remove Cycle2 
Plugin URI: http://www.alphachannelgroup.com/
Description: This plugin de-enqueues the Cycle 2 slideshow script.
Author: Alpha Channel Group
Author URI: http://www.alphachannelgroup.com/
Version: 1.0
*/

add_action('wp_print_scripts', 'realto_cleanup_scripts');

function realto_cleanup_scripts() {
	 wp_dequeue_script( 'nt-jquery.cycle2.min' );
}

Beware of WordPress Plugin Bloat

Thursday, May 26th, 2011

I Love WordPress

WordPress is amazing, there’s no two ways about it. I’m a huge fan, and I’ve therefore found myself doing lots of WordPress development and programming for my clients. Read More →

Taming Media Upload in Your Theme or Plugin

Friday, April 8th, 2011

And changing that pesky “Insert Into Post” button

For all you WordPress developers out there, here’s some good news:

You CAN use the built-in WordPress Media Upload functionality in your plugin or theme.  I can’t take credit for figuring THAT out – that goes to Matt with Read More →

Typekit and Google Expand Web-Safe Fonts

Thursday, March 3rd, 2011

Forever, there’s been only a small handful of font selections that you could use safely on your website. Literally – like 8 different fonts that you could be sure would be on everyone’s browser.

But now, thanks to two awesome services, you can use a much larger variety of fonts. Read More →