Last active
May 29, 2019 04:49
-
-
Save neilgee/c1ad4088cad40d201bcd010c1268a314 to your computer and use it in GitHub Desktop.
Style Default Select Form Elements Using Selectize JS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // <~ don't add me in | |
add_action('wp_enqueue_scripts', 'my_select_dropdown'); | |
function my_select_dropdown() { | |
if( is_shop() || is_product_category() ) { | |
wp_enqueue_style( 'select2'); | |
wp_enqueue_script( 'selectinit', get_stylesheet_directory_uri() . '/js/select2-init.js', array( 'selectWoo' ), '1.0.0', true ); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // <~ don't add me in | |
add_action('wp_enqueue_scripts', 'my_select_dropdown'); | |
function my_select_dropdown() { | |
wp_enqueue_script( 'select2js', get_stylesheet_directory_uri() . '/js/select2.min.js', array( 'jquery' ), '4.0.6', true ); | |
wp_enqueue_style( 'select2css', get_stylesheet_directory_uri() . '/css/select2.min.css' , array(), '4.0.6', 'all' ); | |
wp_enqueue_script( 'selectinit', get_stylesheet_directory_uri() . '/js/select2-init.js', array( 'select2js' ), '1.0.0', true ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($) { | |
$('.woocommerce-ordering select').select2(); // Add your target select field | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment