How do I sanitize the str_replace function in javascript variables

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

datepicker for custom post type admin

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

Adding jQuery datepicker to Custom Post Type Metabox [closed]

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

html element to separate php variable strings – ACF datepicker

thanks to @kero, i managed to do something like this : <?php $dayNumber = “l”; $weekDay = “j”; $month = “F”; $year = “Y”; $unixtimestamp = strtotime(get_field(‘date’)); ?> <?php echo ‘<span>’ . date_i18n($dayNumber, $unixtimestamp) . ‘</span>’; ?> <?php echo ‘<span>’ . date_i18n($weekDay, $unixtimestamp) . ‘</span>’; ?> <?php echo ‘<span>’ . date_i18n($month, $unixtimestamp) . ‘</span>’; ?> … Read more

How to use datepicker.min.js?

ok, i got it, i was adding it to input name & not input class ! <script type=”text/javascript”> jQuery(document).ready(function($) { $(‘.mkdf-filter-min-date’).datepicker({ dateFormat : ‘yy-mm-dd’ }); }); </script>

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)