-
Notifications
You must be signed in to change notification settings - Fork 0
/
shortcode.php
21 lines (20 loc) · 941 Bytes
/
shortcode.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function tribe_recurrence_schedule_meta(){
global $post;
$details = "";
$format = 'F j, Y';
$format2 = 'g:i a';
if( tribe_is_recurring_event($post) ) {
$recurrence = get_post_meta( $post->ID, '_EventRecurrence', true );
$details .= '<ul class="calendar-list">';
foreach($recurrence['rules'] as $eachevent){
if($eachevent['custom']['type'] == 'Date'){
$details .= '<li>'.date( $format, strtotime( $eachevent['custom']['date']['date'] ) ).' @ '.$eachevent['custom']['start-time'].'-'.$eachevent['custom']['end-time'].'</li>';
}else{
$details .= '<li>'.$eachevent['custom']['type'].' @ '.date( $format2, strtotime($eachevent['EventStartDate'])).'-'.date( $format2, strtotime($eachevent['EventEndDate'])).' until '.date( $format, strtotime( $eachevent['end'] ) ).'</li>';
}
}
$details .= '</ul>';
}
return $details;
}
add_shortcode('recurrence_schedule', 'tribe_recurrence_schedule_meta');