Created
December 17, 2015 17:30
-
-
Save joshfeck/8f7c3c379fa7c9475187 to your computer and use it in GitHub Desktop.
adds a datepicker calendar to your specified Event Espresso text field question
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 | |
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file | |
// datepicker jQuery for Event Espresso 3 | |
// | |
add_action('wp_enqueue_scripts', 'my_custom_espresso_scripts'); | |
function my_custom_espresso_scripts() { | |
global $load_espresso_scripts; | |
if ( ! $load_espresso_scripts ) | |
return; | |
// load jQuery UI scripts from WP Core | |
wp_enqueue_script('jquery-ui-core'); | |
wp_enqueue_script('jquery-ui-datepicker'); | |
// load up a theme (you can set your own theme below if you did not activate the themeroller option in ee3) | |
// in this example, it's loading up the Cupertino theme | |
wp_enqueue_style('jquery-ui-css', | |
'http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/cupertino/jquery-ui.css', | |
false, | |
1.0, | |
false); | |
} | |
add_action('wp_footer', 'my_custom_datepicker_input'); | |
function my_custom_datepicker_input() { | |
global $load_espresso_scripts; | |
if ( ! $load_espresso_scripts ) | |
return; | |
?> | |
<script>jQuery(document).ready(function($){ | |
// set the input class as the selector below, in this example, it's Question ID 13 | |
$( ".TEXT_13" ).datepicker(); | |
}); | |
</script> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment