siga
6/26/2016 - 1:00 PM

If you’re enqueuing a script that requires additional Javascript to run properly (ex: targeting the proper div for your carousel and adding

If you’re enqueuing a script that requires additional Javascript to run properly (ex: targeting the proper div for your carousel and adding parameters), add that as an inline script rather than creating a separate JS file. (c) Bill Erickson, http://www.billerickson.net/code/add-inline-script/

<?php
$gallery = ea_cf( 'ea_product_gallery' );
if( $gallery ) {
  
  wp_enqueue_script( 'slick' );
  wp_add_inline_script( 'slick', 'jQuery(document).ready(function($){$(".product-gallery").slick({autoplay: false, arrows: false, dots: true, });});' );
  
  // output gallery
}