Skip to content

Instantly share code, notes, and snippets.

@afragen
Last active December 20, 2015 17:49
Show Gist options
  • Save afragen/6171751 to your computer and use it in GitHub Desktop.
Save afragen/6171751 to your computer and use it in GitHub Desktop.
Template overrides to colorize TECPro widgets using The Events Calendar Category Colors plugin. The templates belong in {THEME}/tribe-events/widgets/ or {THEME}/tribe-events/widgets/mini-calendar/
<?php
//this belongs in {THEME}/tribe-events/pro/widgets/
/**
* Events Pro List Widget Template
* 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.
*
* Override this template in your own theme by creating a file at [your-theme]/tribe-events/widgets/list-widget.php
*
* When the template is loaded, the following vars are set: $start, $end, $venue,
* $address, $city, $state, $province'], $zip, $country, $phone, $cost
*
* @package TribeEventsCalendarPro
* @since 1.0
* @author Modern Tribe Inc.
*
*/
if ( !defined('ABSPATH') ) { die('-1'); } ?>
<?php
$widget_args = tribe_events_get_adv_list_widget_args();
extract($widget_args);
global $post;
?>
<?php do_action( 'tribe_before_widget' ); ?>
<li>
<h4 class="entry-title summary tribe-events-category-<?php echo current(tribe_get_event_cat_slugs($post->ID)); ?>">
<a href="<?php echo tribe_get_event_link(); ?>" rel="bookmark"><?php the_title(); ?></a>
</h4>
<div class="duration">
<?php echo tribe_events_event_schedule_details(); ?>
</div>
<?php if ( $cost && tribe_get_cost() != '' ) { ?>
<span class="tribe-events-divider">|</span>
<div class="tribe-events-event-cost">
<?php echo tribe_get_cost( null, true ); ?>
</div>
<?php } ?>
<div class="vcard adr location">
<?php if ( $venue && tribe_get_venue() != '') { ?>
<span class="fn org tribe-venue"><?php echo tribe_get_venue_link(); ?></span>
<?php } ?>
<?php if ( $address && tribe_get_address() != '' ) { ?>
<span class="street-address"><?php echo tribe_get_address(); ?></span>
<?php } ?>
<?php if ( $city && tribe_get_city() != '' ) { ?>
<span class="locality"><?php echo tribe_get_city(); ?></span>
<?php } ?>
<?php if ( $region && tribe_get_region() !='' ) { ?>
<span class="region"><?php echo tribe_get_region(); ?></span>
<?php } ?>
<?php if ( $zip && tribe_get_zip() != '' ) { ?>
<span class="postal-code"><?php echo tribe_get_zip(); ?></span>
<?php } ?>
<?php if ( $country && tribe_get_country() != '') { ?>
<span class="country-name"><?php echo tribe_get_country(); ?></span>
<?php } ?>
<?php if ( $organizer && tribe_get_organizer() != '' ) { ?>
<?php _e( 'Organizer:', 'tribe-events-calendar-pro' ); ?>
<span class="tribe-organizer"><?php echo tribe_get_organizer_link(); ?></span>
<?php } ?>
<?php if ( $phone && tribe_get_phone() != '' ) { ?>
<span class="tel"><?php echo tribe_get_phone(); ?></span>
<?php } ?>
</div>
</li>
<?php
//this belongs in {THEME}/tribe-events/pro/widgets/mini-calendar/
* Mini Calendar List Loop
* This file sets up the structure for the list loop
*
* Override this template in your own theme by creating a file at [your-theme]/tribe-events/pro/widgets/mini-calendar/list.php
*
* @package TribeEventsCalendar
* @since 3.0
* @author Modern Tribe Inc.
*
*/
if ( !defined('ABSPATH') ) { die('-1'); } ?>
<?php do_action( 'tribe_before_widget' ); ?>
<div class="tribe-mini-calendar-list-wrapper">
<div class="tribe-events-loop hfeed vcalendar">
<?php while ( have_posts() ) : the_post(); ?>
<?php do_action('tribe_events_mini_cal_list_inside_before_loop'); ?>
<!-- Event -->
<?php tribe_events_event_classes() ?>
<?php tribe_get_template_part('pro/widgets/mini-calendar/single-event') ?>
<!-- .hentry .vevent -->
<?php do_action( 'tribe_events_mini_cal_list_inside_after_loop' ); ?>
<?php endwhile; ?>
</div><!-- .tribe-events-loop -->
</div> <!-- .tribe-mini-calendar-list-wrapper -->
<?php
//this belongs in {THEME}/tribe-events/pro/widgets/mini-calendar/
global $post, $wp_query;
$class = "";
if ( $wp_query->current_post == 1 ) {
$class = ' first ';
}
if ( $wp_query->current_post+1 == $wp_query->post_count ) {
$class .= ' last ';
}
$startDate = strtotime( $post->EventStartDate );
$endDate = strtotime( $post->EventEndDate );
$today = time();
/* If the event starts way in the past or ends way in the future, let's show today's date */
if ( $today > $startDate && $today < $endDate )
$postDate = $today; else
$postDate = $startDate;
/* If the user clicked in a particular day, let's show that day as the event date, even if the event spans a few days */
if ( defined( "DOING_AJAX" ) && DOING_AJAX && isset( $_POST['action'] ) && $_POST['action'] == 'tribe-mini-cal-day' )
$postDate = strtotime( $_POST["eventDate"] );
?>
<div class="tribe-mini-calendar-event event-<?php echo $wp_query->current_post;?><?php echo $class;?>">
<div class="list-date">
<span
class="list-dayname"><?php echo apply_filters( 'tribe-mini_helper_tribe_events_ajax_list_dayname', date( 'D', $postDate ), $postDate, $class ); ?></span>
<span
class="list-daynumber"><?php echo apply_filters( 'tribe-mini_helper_tribe_events_ajax_list_daynumber', date( 'd', $postDate ), $postDate, $class ); ?></span>
</div>
<div class="list-info">
<h2 class="tribe-events-category-<?php echo current(tribe_get_event_cat_slugs($post->ID)); ?>"><a href="<?php echo tribe_get_event_link(); ?>"><?php echo $post->post_title; ?></a></h2>
<?php if ( tribe_get_cost() ) { ?>
<span class="tribe-mini-calendar-event-cost"><?php echo tribe_get_cost( null, true ); ?></span>
<div class="tribe-events-divider ">|</div>
<?php } ?>
<?php echo tribe_events_event_schedule_details(); ?>
<?php if ( tribe_get_venue() ) { ?>
<div class="tribe-mini-calendar-event-venue">
<?php echo tribe_get_venue_link( $post->ID ); ?>
</div>
<?php } ?>
</div>
</div>
@afragen
Copy link
Author

afragen commented Nov 17, 2013

Fix for 'array to string' error

@afragen
Copy link
Author

afragen commented Nov 17, 2013

Fix for correct path pro/widgets/mini-calendar/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment