Skip to content

Instantly share code, notes, and snippets.

@SiGaCode
Created June 26, 2016 13:00
Show Gist options
  • Select an option

  • Save SiGaCode/a13bb7123996670ab91c4ff36805a98d to your computer and use it in GitHub Desktop.

Select an option

Save SiGaCode/a13bb7123996670ab91c4ff36805a98d to your computer and use it in GitHub Desktop.
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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment