-
-
Save ryanurban/7030403 to your computer and use it in GitHub Desktop.
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
add_action( 'wp_footer', 'community_add_javascript', 100 ); | |
function community_add_javascript() { | |
if ( tribe_is_community_edit_event_page() ) { | |
?> | |
<script type="text/javascript"> | |
jQuery(document).ready(function($) { | |
// Customize Events Community Datepicker | |
if(jQuery("#EventStartDate, #EventEndDate").length) { | |
var datepickerOpts = { | |
dateFormat: 'mm-dd-yy', | |
changeMonth: true, | |
changeYear: true, | |
onSelect: function(selectedDate) { | |
var option = this.id == "EventStartDate" ? "minDate" : "maxDate"; | |
var instance = jQuery(this).data("datepicker"); | |
var date = jQuery.datepicker.parseDate(instance.settings.dateFormat || jQuery.datepicker._defaults.dateFormat, selectedDate, instance.settings); | |
dates.not(this).not('#recurrence_end').datepicker("option", option, date); | |
} | |
} | |
var dates = jQuery("#EventStartDate, #EventEndDate, .datepicker").datepicker(datepickerOpts); | |
} | |
}); | |
</script> | |
<?php | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment