Date Picker
-
I bought product add on by woo commerce as it its docs https://docs.woothemes.com/document/product-add-ons/ it says you can add a date picker by the following actions
This can be done with a little custom code. Use a custom text input field, then via your theme functions.php file you can enqueue the jquery ui datepicker and a custom script:
add_action( ‘wp_enqueue_scripts’, ‘custom_enqueue_datepicker’ );function custom_enqueue_datepicker() {
// Optional – enqueue styles
wp_enqueue_style( ‘jquery-ui’, ‘https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/themes/smoothness/jquery-ui.css’, false, ‘1.0’, false );// Enqueue YOURTHEME/js/datepicker.js
wp_enqueue_script( ‘your-datepicker-script’, get_stylesheet_directory_uri() . ‘/js/datepicker.js’, array( ‘jquery’, ‘jquery-ui-datepicker’ ), ‘1.0’, true );
}Then in yourtheme/js/datepicker.js you would init your datepicker like this:
// Check the name of your addon field in the source. Example: addon-7934-test-addon
jQuery( “input[name=addon-7934-test-addon]” ).datepicker( {
minDate: 0,
“dateFormat”: ‘yy-mm-dd’
} );The first part I did i added that code into function php
the second part I added the name of my add-on field, but don’t know where to paste the code. Where is yourtheme/js/datepicker.js located.Hope someone can help I have such a headache from scouring the internet for days, woo won’t help, the author isn’t helping and this is the only thing holding my site back, and its very important.
Thanks
- The topic ‘Date Picker’ is closed to new replies.