Skip to content

Instantly share code, notes, and snippets.

@alanef
Created November 5, 2019 10:09
Show Gist options
  • Select an option

  • Save alanef/f08542084f67fd6a3aaefbb2249b876f to your computer and use it in GitHub Desktop.

Select an option

Save alanef/f08542084f67fd6a3aaefbb2249b876f to your computer and use it in GitHub Desktop.
<?php
/*
Plugin Name: Date Picker Issue
Plugin URI: https://
Description: Shortcode [datetest] this plugin demonstrates that the id selector does not work when The7 theme is active with WP Bakery and on the WooCommerce shop page
Version: 0.1
Author: Alan
*/
add_action('wp_enqueue_scripts', function() {
wp_enqueue_script( 'jquery-ui-datepicker' );
});
add_action('wp_footer', function(){
?>
<script>
(function ($) {
$( "#datepickertestid" ).datepicker();
$( ".datepickertestclass" ).datepicker();
} )(jQuery);
</script>
<?php
},998989);
add_shortcode( 'datetest', function ( $atts ) {
?>
<p>Date via ID: <input type="text" id="datepickertestid"></p>
<p>Date via Class: <input type="text" class="datepickertestclass"></p>
<?php
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment