Realto Theme Plus dsIDXpress Plugin Results in Double Thumbnails

Posted on 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' );
}

Leave a Reply

(required)

comment on this post »

No comments on this post yet.