编写所需的javascript,然后使用此代码将其显示在页面上,这样可以确保仅在显示日历时才包含脚本
add_filter(\'get_calendar\', \'add_calendar_scripts\');
function add_calendar_scripts($content) {
add_action( \'wp_footer\', \'output_calendar_scripts\', 11);
return $content;
}
function output_calendar_scripts() {
?>
<script type="text/javascript" src="<?php echo get_template_directory_uri();?>/path/to/script.js"></script>
<?php
}