• Hi,

    Plugin doesn’t initialize when we load jquery from footer because variable $output add slide settings below owl-carousel divs only when wp_script_is('jquery', 'done') which means plugin will work correctly when jquery is loaded in head.

    There is a few ways to resolve it. One of it, is add slide settings below line where plugin load file ‘owl.carousel.min.js’.
    If is only one slider then add slide settings with <script> tag otherwise if is more sliders than one then add <script> tag with first slider settings and other sliders settings just input inside it.

    Regards,
    Callenowy

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter callenowy

    (@callenowy)

    I made a quick fix for it.

    in file slide-anything-frontend.php:
    * removed wp_enqueue_script('owl_carousel_js'); in line 12,
    * removed if (wp_script_is('jquery', 'done')) { // Only generate JQuery code if JQuery has been loaded in line 214,
    * changed variable name from $output to $outputScript below <script> tag
    * and at the end below end of <script> tag made something like this:

    function enqueue_output_script($attr) {
         wp_enqueue_script('owl_carousel_js', SA_PLUGIN_PATH.'owl-carousel/owl.carousel.min.js', array('jquery'), '1.3.3', true);
         wp_add_inline_script( 'owl_carousel_js', $attr );
    }
    
    add_action( 'wp_enqueue_scripts', 'enqueue_output_script', 10, 1 );
    do_action('wp_enqueue_scripts', $outputScript);

    Solution found here:
    https://wordpress.stackexchange.com/a/226688

    and working fine!

    • This reply was modified 8 years, 5 months ago by callenowy. Reason: added link to example solution
    • This reply was modified 8 years, 5 months ago by callenowy.
    Thread Starter callenowy

    (@callenowy)

    Above fix working only with one slider btw.

    Plugin Author simonpedge

    (@simonpedge)

    Hi, thank you for looking into this problem, and finding a coding solution.

    I’ll be incorporating this fix into the next release of Slide Anything, which will be a major release (version 2.0), build on the back of Owl Carousel 2.0. I’m planing to have this release out by the end of the year, and it will have loads of new features.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘error init slider while loading jquery in footer’ is closed to new replies.