是否可以最小化日历中某一天(w / event)显示的数据?我知道这似乎是一个奇怪的要求。具体来说,我想要删除标题和开始时间...基本上如果我可以只有一个css类与事件的几天,或者我对当前的“泡沫”很好,它现在显示只是没有额外的信息。 http://www.seattledesigndistrict.com/events/是我正在使用的日历。它从wordpress自定义帖子类型中提取数据:
<script type="text/javascript">
$(document).ready(function(){
$('#calendar').fullCalendar({
header: {
left: 'prev,next ',
center: 'title',
right: ''
},
weekMode: 'liquid',
height: 250,
events: [
<?php
$myEvents = get_posts('post_type=event&orderby=title&order=ASC&numberposts=-1');
$eventString = '';
foreach($myEvents as $event){
$eventString .= '{ title: \''.$event->post_title.'\',';
$eventDate = get_post_meta($event->ID,'event_date',true);
$dateParts = explode('-',$eventDate);
$startTime = get_post_meta($event->ID,'starttime',true);
if($startTime != ''){
$startTimeArray = explode(':',$startTime);
$makeStart = mktime($startTimeArray[0],$startTimeArray[1],0,$dateParts[1],$dateParts[2],$dateParts[0]);
} else {
$makeStart = mktime(12,0,0,$dateParts[1],$dateParts[2],$dateParts[0]);
}
$displayDate = date('c',$makeStart);
$eventString .= 'start: \''.$displayDate.'\',';
$endTime = get_post_meta($event->ID,'endtime',true);
if($endTime != ''){
$endTimeArray = explode(':',$endTime);
$makeEnd = mktime($endTimeArray[0],$endTimeArray[1],0,$dateParts[1],$dateParts[2],$dateParts[0]);
$displayEndDate = date('c',$makeEnd);
$eventString .= 'end: \''.$displayEndDate.'\',';
}
$eventString .= 'url: \''.$event->guid.'\',';
$eventString .= 'allDay: false},';
}
$eventString = substr($eventString, 0, -1);
echo $eventString;
?>
]
})
});
</script>
任何帮助将不胜感激。
答案 0 :(得分:2)
使用documentation中所述的eventRender
挂钩。钩子使您可以访问用于呈现事件的元素。下面的代码删除了文本,将框保留原样。
<script type="text/javascript">
$(document).ready(function(){
$('#calendar').fullCalendar({
// your other code here
eventRender: function(event, element) {
$(element).
remove(".fc-event-time"). // the time span in a full calendar event
remove(".fc-event-title"); // the title span in a full calendar event
}
})
});
</script>