Skip to content

Instantly share code, notes, and snippets.

Created August 21, 2012 14:52
Show Gist options
  • Select an option

  • Save anonymous/3416224 to your computer and use it in GitHub Desktop.

Select an option

Save anonymous/3416224 to your computer and use it in GitHub Desktop.
<?php
/**
* This is the template for the output of the events list widget.
* All the items are turned on and off through the widget admin.
* There is currently no default styling, which is highly needed.
*
* You can customize this view by putting a replacement file of the same name (events-list-load-widget-display.php) in the events/ directory of your theme.
*
* @return string
*/
// Vars set:
// '$event->AllDay',
// '$event->StartDate',
// '$event->EndDate',
// '$event->ShowMapLink',
// '$event->ShowMap',
// '$event->Cost',
// '$event->Phone',
// Don't load directly
if ( !defined('ABSPATH') ) { die('-1'); }
$event = array();
$tribe_ecp = TribeEvents::instance();
reset($tribe_ecp->metaTags); // Move pointer to beginning of array.
foreach($tribe_ecp->metaTags as $tag){
$var_name = str_replace('_Event','',$tag);
$event[$var_name] = tribe_get_event_meta( $post->ID, $tag, true );
}
$event = (object) $event; //Easier to work with.
ob_start();
if ( !isset($alt_text) ) { $alt_text = ''; }
post_class($alt_text,$post->ID);
$class = ob_get_contents();
ob_end_clean();
?>
<li <?php echo $class ?>>
<div class="when">
<?php
$space = false;
$output = '';
if( tribe_is_multiday( $post->ID ) {
//Don't include the time
echo tribe_get_start_date($post->ID, false, 'F j, Y');
} else {
echo tribe_get_start_date( $post->ID );
}
if( tribe_is_multiday( $post->ID ) || !$event->AllDay ) {
//Don't include the time
echo ' - ' . tribe_get_end_date($post->ID, false, 'F j, Y');
}
if($event->AllDay) {
echo ' <small>('.__('All Day','tribe-events-calendar').')</small>';
}
?>
</div>
<div class="event">
<a href="<?php echo get_permalink($post->ID) ?>"><?php echo $post->post_title ?></a>
</div>
</li>
<?php $alt_text = ( empty( $alt_text ) ) ? 'alt' : ''; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment