How to solve a conflict between a plugin and a theme?

I’m using Photospace as a gallery slider within my hatch pro wp theme (you can check here).

The default transition effect between slides is a crossover effect (like this example), but the effect in my slider seems to be image fade to white, then white fades to image. Not sure why this is happening.

Read More

Here is the code that calls other scripts:

    /* Enqueue scripts (and related stylesheets) */

add_action( 'wp_enqueue_scripts', 'hatch_pro_scripts' );
function hatch_pro_scripts() {

if ( !is_admin() ) {

    /* Enqueue Scripts */
    wp_enqueue_script( 'hatch_pro_fitvids', get_template_directory_uri() . '/js/fitvids/jquery.fitvids.js', array( 'jquery' ), '1.0', true );


    /* Enqueue Fancybox */
    if ( hybrid_get_setting( 'hatch_pro_fancybox_enable' ) ) {
        wp_enqueue_script( 'hatch_pro_fancybox', get_template_directory_uri() . '/js/fancybox/jquery.fancybox-1.3.4.pack.js', array( 'jquery' ), '1.0', true );     
        wp_enqueue_style( 'hatch_pro_fancybox-stylesheet', get_template_directory_uri() . '/js/fancybox/jquery.fancybox-1.3.4.css', false, 1.0, 'screen' );
        wp_enqueue_script( 'hatch_pro_footer-scripts', get_template_directory_uri() . '/js/footer-scripts.js', array( 'jquery', 'hatch_pro_fitvids', 'hatch_pro_fancybox' ), '1.0', true ); 
    } else {
        wp_enqueue_script( 'hatch_pro_footer-scripts-light', get_template_directory_uri() . '/js/footer-scripts-light.js', array( 'jquery', 'hatch_pro_fitvids' ), '1.0', true );   
    }
}

}

How can I resolve this?

I’m comfortable with CSS, but not so much with PHP or other heavier coding.

Related posts

Leave a Reply

1 comment

  1. If the theme was coded using Theme Development Standards, then you can use the function wp_deregister_script to remove conflicting scripts from the page where the slider is being used.


    [update]
    The original solution (at the bottom) worked in a specific plugin situation (with WP Touch).
    I think this is the proper one:

    add_action( 'wp_enqueue_scripts', 'wpse_77772_remove_theme_enqueues', 11 );
    
    function wpse_77772_remove_theme_enqueues()
    {
        if( is_front_page() || is_home() ) 
        {
            wp_dequeue_script('hatch_pro_fancybox');
            // etc
        }
    }
    

    [first version]

    For example, in the following snippet I’m removing all the scripts and style of the plugin Alo Easy Mail if the site is being viewed in a mobile device, check comments for your use case.

    Put it at the end of the theme’s functions.php file (or child theme’s).

    add_action( 'wp_head', 'wpse_77772_remove_plugin_scripts', 1 );
    
    /**
     * You'd probably want to use
     * if( is_front_page() || is_home() ) 
     *
     * see: http://wordpress.stackexchange.com/q/30385/12615
     */
    function wpse_77772_remove_plugin_scripts()
    {
        if( wp_is_mobile() ) {
            remove_action('wp_head', 'add_css');
            wp_deregister_script('jqplot');
            wp_deregister_script('bar');
            wp_deregister_script('cax');
            wp_deregister_script('pol');
            wp_deregister_script('fun');
            wp_deregister_script('pie');
            wp_deregister_script('meg');
        }
    }
    

    This way, you can remove the conflicting scripts from a specific page, and let them load in the rest.

    Search your theme for wp_register_script and grab the handle to use with deregister.

    The remove_action works upon all add_action that the theme has.