• Resolved funnyhaha

    (@funnyhaha)


    Hi!

    I just installed the plugin, but I get Uncaught TypeError: jQuery(...).slick is not a function(…).

    I don’t understand why exactly. The JS includes look to be correct. I include my JS scripts at the bottom of the page just before I close </body>. The order seems correct too:

    <script type='text/javascript' src='https://localhost:8080/wp-includes/js/jquery/jquery.js?ver=1.12.4'></script>
    <script type='text/javascript' src='https://localhost:8080/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.4.1'></script>
    <script type='text/javascript' src='https://localhost:8080/wp-content/plugins/slick-slider/bower_components/slick-carousel/slick/slick.min.js?ver=1.6.0'></script>
    <script type='text/javascript'>
    jQuery( document ).ready( function() {
    	jQuery( '.slick-slider-wrapper .slick-slider' ).slick();
    } );
    </script>

    When I go look at https://localhost:8080/wp-content/plugins/slick-slider/bower_components/slick-carousel/slick/slick.min.js?ver=1.6.0 slick is there. Any ideas?

    Best,
    Marco

    • This topic was modified 8 years ago by funnyhaha.
Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Philipp Bammes

    (@tyrannous)

    Hi!

    Congratulations for opening the first support thread for this plugin! ??

    Am I understand you correctly: You include the JS scripts manually? If so, don’t do it this way.
    The plugin enqueues (adds) all needed scripts and styles automatically for you.

    (If you are new to WordPress (since you created your account today) you may want to read about correctly adding scripts and styles in WordPress: https://www.wpbeginner.com/wp-tutorials/how-to-properly-add-javascripts-and-styles-in-wordpress/)

    If I misunderstand you, feel free to post a link to the site where you are having problems so I can try to check this out.

    Thread Starter funnyhaha

    (@funnyhaha)

    I don’t include it manually.

    The problem is most likely that I’m using two jQuery Version, one from wordpress and one from my theme.

    slick.min.js hooks into the WP jQuery but then get’s overwritten by my themes jQuery version, so jQuery('.slick-slider-wrapper .slick-slider').slick() is undefined.

    I need my own jQuery though. Looking for a way to get your plugin to not register slick so I can do it myself after my theme’s jQuery is initialized.

    Tried this and a few variations, but it doesn’t work:

    
    add_action("wp_enqueue_scripts", "my_enqueue");
    
    function my_enqueue() {
      wp_dequeue_script('slick-slider-core');
    }
    
    Plugin Author Philipp Bammes

    (@tyrannous)

    wp_dequeue_script(); is the wrong function to call.

    Use wp_deregister_script( 'slick-slider-core' ); instead:

    `
    add_action( ‘wp_enqueue_scripts’, ‘slick_slider_deregister_core-js’ );
    function slick_slider_deregister_core() {
    wp_deregister_script( ‘slick-slider-core’ );
    }
    `

    I will add that to the plugin’s FAQ section.

    Thread Starter funnyhaha

    (@funnyhaha)

    Thank you for your help!

    It would be nice to have a filter like the existing one (slick_slider_init_slider) for script slick-slider-core and styles slick-slider-core,slick-slider-core-theme so you can easily use your own slick.

    • This reply was modified 8 years ago by funnyhaha.
    Plugin Author Philipp Bammes

    (@tyrannous)

    I just edited my reply. Please see above.

    Edit: Use this one, the code block in my reply has a bug but I can’t edit it anymore.

    
    add_action( 'wp_enqueue_scripts', 'slick_slider_deregister_core_js' );
    function slick_slider_deregister_core_js() {
    	wp_deregister_script( 'slick-slider-core' );
    }
    

    If this works for you, feel free to set this thread to resolved.

    Thread Starter funnyhaha

    (@funnyhaha)

    add_action( 'wp_enqueue_scripts', 'slick_slider_deregister_core_js', 1000); works, the priority at the end is important (doesn’t work without it).

    If you’re adding this to the FAQ it might be worth mentioning that this also deregisters the inclusion of the plugins slick init-script js/slick-slider-init.js.

    Also wp_deregister_style('slick-slider-core'); and wp_deregister_style('slick-slider-core-theme'); remove the styles.

    Plugin Author Philipp Bammes

    (@tyrannous)

    I’ve added it to the FAQ section which will get deployed in v0.3.

    If you want to do me a favor rate the plugin if you like it.

    Hi @phillip!

    Thanks so much for your plugin – we’re using it on ywamkona.org which we just launched recently.

    However, it looks like when we install either of these plugins:
    Jetpack – https://www.ads-software.com/plugins/jetpack/
    Google Tag Manager – https://www.ads-software.com/plugins/duracelltomi-google-tag-manager/

    We get the same error:

    “jquery.js?ver=1.12.4:2 Uncaught TypeError: $(…).slick is not a function”

    As well as a few:

    “TypeError: jQuery.easing[jQuery.easing.def] is not a function(”

    And our sliders don’t work but show one on top of each other.

    I’ve checked the version of jQuery and it does seem to be

    jQuery.fn.jquery
    “1.12.4”

    which is the default wordpress one, and not 3.1.0 which i included in our main ywam.js file (which is all our js files in one grunted, minified/uglified file)

    When i go into wordpress/wp-includes/js/jquery/jquery.js & manually change it to 3.1.0 it still has the same problem – so not sure what i should do? Do you have any tips?

    Here’s a live sandbox site with the issue:
    https://sandbox.ywamkona.org

    Here’s a screenshot:
    https://www.dropbox.com/s/is0qxzg01fdjznj/Screenshot%202016-12-11%2022.48.27.png?dl=0

    Any tips or thoughts?

    • This reply was modified 7 years, 11 months ago by jonchui. Reason: adding more details
    Plugin Author Philipp Bammes

    (@tyrannous)

    Hi @jonchui,
    let me get back to you when I’ll be home after work.
    Do you mind opening a new thread in the meantime? Better not touch resolved threads because doing so probably spams @funnyhaha’s inbox.

    Thanks!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Uncaught TypeError: jQuery(…).slick is not a function(…)’ is closed to new replies.