WP 3.3.1 Cant get jQuery Datepicker to work
CSS needs to be in the head of the document. Use the admin_enqueue_scripts hook instead. Also be sure to only enqueue the scripts and styles on screens where you need them.
CSS needs to be in the head of the document. Use the admin_enqueue_scripts hook instead. Also be sure to only enqueue the scripts and styles on screens where you need them.
The problem is that your first block of inline datepicker js is before jQuery and jQuery UI. When you use wp_enqueue_script your script tags will be output where your wp_head() action hook is located. Move your inline datepicer js below wp_head and your jQuery should work. You should also be using the no conflict wrapper … Read more
HereĀ“s something to get you started. Adapt the code below to your needs Create an init.js file with notepad and paste your code in there Save it in a logical place your theme folder (the JS directory for example) Register and enqueue this file (make sure to load it after jquery) Datepicker set up: /* … Read more
ACF using milliseconds is not standard for timestamps, and nor is it useful. How much accuracy do you need? Bear in mind that converting to something like yyyymmdd will not accommodate timezones. If you have access to PHPMyAdmin (or similar) and know your way around SQL, running a quick query would probably be the easiest … Read more
It’s a UNIX timestamp – with PHP, you can use date to format it like so: echo date( ‘d/m/Y’, $timestamp ); // day/month/year
The script itself is no longer on the google hosted link. You should try updating to WordPress v4.7.1 or reporting the bug if it still persists after that
It sounds like you need an introduction to plugin development. As in all things WordPress Development, the WordPress Codex is the first place to look. Here is the Plugin Development information: https://developer.wordpress.org/plugins/ But you will need some PHP programming knowledge. Here’s one good place to start: https://www.w3schools.com/php/default.asp . And the googles have plenty of information … Read more
esc_js() is intended for escaping data for use within an HTML attribute. If you want to escape data for use within an inline script, wp_json_encode() should be sufficient. For example: var disabledDays = <?php echo wp_json_encode( $iva_disable_days ); ?>; This outputs: var disabledDays = [“4\/7\/2018″,”11\/18\/2017”]; If you check the variable in your dev tools console, … Read more
Issues I noticed in your code I don’t see where/how you’re calling that custom datepicker() function and you should use the same admin_enqueue_scripts hook for registering/enqueueing a stylesheet (.css) file. You should only load the CSS and JS files on the pages where the styles and scripts are being used, e.g. in your case, the … Read more
To properly work I didn’t write my js file like you. My code will only stand for admin side not the frontend. In the js enqueue js file (date-picker.js): jQuery(document).ready(function(){ jQuery(‘.ads_datepicker’).datepicker({ dateFormat: ‘yy-mm-dd’ }); }); I enqueue my script like this add_action( ‘admin_enqueue_scripts’, array($this, ‘enqueue_date_picker’ ) ); public function enqueue_date_picker(){ wp_enqueue_script( ‘date-picker-js’, plugins_url(‘/js/date_picker.js’, __FILE__), array(‘jquery’, … Read more