Support » Plugin: WooCommerce Product Images Slider » PrettyPhoto dependency / dequeuing WPIS

  • Resolved simooo

    (@simooo)


    Hi there,

    Sorry for posting another question so soon, but wanted to get your take on another issue.

    I noticed that JavaScript is crashing on my shop page because WPIS is trying to run PrettyPhoto. Maybe it is typically available by default on the shop page, I’m not sure. Either way it isn’t in my case, so the plugin’s JS crashes.

    Here’s the enqueuing function in the plugin:

    function wpis_enqueue_scripts() {
    	if (!is_admin()) {
    		wp_enqueue_script('wpis-slick-js', plugins_url('assets/js/slick.min.js', __FILE__),array('jquery'),'1.6.0', false);
    		wp_enqueue_script('wpis-fancybox-js', plugins_url('assets/js/jquery.fancybox.js', __FILE__),array('jquery'),'1.0', true);
    		wp_enqueue_script('wpis-front-js', plugins_url('assets/js/wpis.front.js', __FILE__),array('jquery'),'1.0', true);
    		wp_enqueue_style('wpis-fancybox-css', plugins_url('assets/css/fancybox.css', __FILE__),'1.0', true);
    		wp_enqueue_style('wpis-front-css', plugins_url('assets/css/wpis-front.css', __FILE__),'1.0', true);
    	}
    }
    add_action( 'wp_enqueue_scripts', 'wpis_enqueue_scripts' ); 

    This looks to me like the WPIS scripts are being loaded on every single (non-admin) page. Or am I missing something? If not, would you know of a good way to remove this action for all pages but the single product page?

    I think this should do it:

    if( !is_product() ) remove_action( 'wp_enqueue_scripts', 'wpis_enqueue_scripts' );

    But I can’t find the right place to run this code, early enough that it’s before the scripts are loaded but not before the is_product() function is available.

    Any thoughts much appreciated.

    Simon

    EDIT: my current solution that feels very hacky and not very future proof is to explicitly dequeue each script inside the wp_enqueue_scripts action and call wpis_enqueue_scripts() from my single product template.

    • This topic was modified 2 years, 9 months ago by simooo.
    • This topic was modified 2 years, 9 months ago by simooo.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author DesirePress

    (@desirepress)

    Hello @simooo,

    Thank you for letting us know about the issue.

    Currently, we are working on plugin next version and we will release it with in 1-2 days along with the solution for the issue that you have mentioned.

    Thanks, please let us know if you found any more issues.

    Regards,
    Desirepress

    • This reply was modified 2 years, 9 months ago by DesirePress.

    Thanks guys – great that you’re able to fix it so soon, looking forward to the update.

    Will let you know if I spot anything else.

    Plugin Author DesirePress

    (@desirepress)

    Hello @simooo,

    Thanks,

    We have released plugin updated version (1.1.1) today.

    Please update your plugin and let us know.

    Regards,
    Desirepress

    Hi there,

    I’ve just completed the updated and can confirm that I’m no longer getting the JS error.

    However the slideshow now seems to have a zoom feature that it didn’t have before. When I hover over the image the mouse pointer turns to a cross and the image zooms in. This is inappropriate for my theme.

    Is this meant to happen and if so can I turn it off?

    Cheers,

    Simon

    Plugin Author DesirePress

    (@desirepress)

    Hello,

    Yes, you can turn off zoom feature with the help of below css.

    .wpis-slider-for .zoomImg {
        display: none !important;
    }

    Please add this css in your theme style.css file.

    Hope it would helpful to you.

    Regards,
    Desirepress

    Hey,

    That seemed to do it, cheers!

    Simon

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘PrettyPhoto dependency / dequeuing WPIS’ is closed to new replies.