DM Albums Jquery Conflict Fix

 139 total views,  1 views today

DM Albums is one of the best most simple slideshow plugins for WordPress. The latest dm albums version though when installed with the latest wordpress caused WordPress dropdown menus not to work when the plugin was activated.

There are lots of suggested fixes, no conflict stuff due to different versions of Jquery, long story short, seems to be a bug in 3.1.9 and here is what fixed my system.

Here is the original code that seems to have a bug in it due to a incorrectly commented line, 3 actually. Original code here and the edited one further below.

This is in ‘wp-dm-albums.php’ in the dm album plugin folder.

function dm_enqueu_scripts()
{
if(get_option(‘DM_JQUERY_LIB’) == “GOOGLE”)
{
//wp_register_script( ‘dm_jquery’, ‘https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js’);
wp_register_script( ‘dm_jquery’, ‘http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js’);
wp_enqueue_script( ‘dm_jquery’ );
}

else if(get_option(‘DM_JQUERY_LIB’) == “REPLACE”)
{
wp_deregister_script( ‘jquery’ );
//wp_register_script( ‘dm_jquery’, ‘https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js’);
wp_register_script( ‘dm_jquery’, ‘http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js’);
wp_enqueue_script( ‘jquery’ );
}

wp_register_script( ‘dm_galleria’, plugins_url() . ‘/dm-albums/galleria/galleria-1.2.8.min.js’, ‘dm_jquery’);

wp_enqueue_script( ‘dm_galleria’ );

wp_register_script( ‘dm_galleria_flikr’, plugins_url() . ‘/dm-albums/galleria/plugins/flickr/galleria.flickr.min.js’, ‘dm_galleria’);

wp_enqueue_script( ‘dm_galleria_flikr’ );

wp_register_script( ‘dm_galleria_common’, plugins_url() . ‘/dm-albums/javascript/galleria-common.js’);
wp_enqueue_script( ‘dm_galleria_common’ );

//wp_register_script( ‘dm_galleria_theme’, plugins_url() . ‘/dm-albums/galleria/themes/dmclassic/galleria.classic.min.js’);
//wp_enqueue_script( ‘dm_galleria_theme’ );
}

 

Here is the modified code, lines highlighted that I changed:

function dm_enqueu_scripts()
{
if(get_option(‘DM_JQUERY_LIB’) == “GOOGLE”)
{
//wp_register_script( ‘dm_jquery’, ‘https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js’);
wp_register_script( ‘dm_jquery’, ‘http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js’);
wp_enqueue_script( ‘dm_jquery’ );
}

else if(get_option(‘DM_JQUERY_LIB’) == “REPLACE”)
{
wp_deregister_script( ‘jquery’ );
wp_register_script( ‘dm_jquery’, ‘https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js’);
//wp_register_script( ‘dm_jquery’, ‘http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js’);
wp_enqueue_script( ‘jquery’ );
}

wp_register_script( ‘dm_galleria’, plugins_url() . ‘/dm-albums/galleria/galleria-1.2.8.min.js’, ‘dm_jquery’);
wp_enqueue_script( ‘dm_galleria’ );

wp_register_script( ‘dm_galleria_flikr’, plugins_url() . ‘/dm-albums/galleria/plugins/flickr/galleria.flickr.min.js’, ‘dm_galleria’);
wp_enqueue_script( ‘dm_galleria_flikr’ );

wp_register_script( ‘dm_galleria_common’, plugins_url() . ‘/dm-albums/javascript/galleria-common.js’);
wp_enqueue_script( ‘dm_galleria_common’ );

wp_register_script( ‘dm_galleria_theme’, plugins_url() . ‘/dm-albums/galleria/themes/dmclassic/galleria.classic.min.js’);
wp_enqueue_script( ‘dm_galleria_theme’ );
}

It appears that no matter the section made, it was ALWAYS loading the jquery.js and not allowing the loading of the older 1.8.0 version. I’m no javascript guy, I just know this seems to have solved my issue. For what its worth to the next guy.

This post has already been read 1615 times!

Leave a Reply

Your email address will not be published.