/** * Enqueue javascript to implement ajax add to cart * * The script is only enqued if : * - the $post is a WP_Post * - the post's content has the shortcode cc_product */ function cc_enqueue_ajax_add_to_cart() { if (cc_page_has_products()) { $url = cc_url(); wp_enqueue_script('cc-add-to-cart', $url . 'resources/js/add-to-cart.js', array('jquery')); $ajax_url = admin_url('admin-ajax.php'); wp_localize_script('cc-add-to-cart', 'cc_cart', array('ajax_url' => $ajax_url)); } }
/** * Enqueue featherlight feature for gallery */ function cc_enqueue_featherlight() { if (cc_page_has_products()) { wp_enqueue_style('featherlight-styles', '//cdn.rawgit.com/noelboss/featherlight/1.2.2/release/featherlight.min.css'); wp_enqueue_script('featherlight', '//cdn.rawgit.com/noelboss/featherlight/1.2.2/release/featherlight.min.js', array('jquery'), '', true); } }