Created
October 29, 2014 00:07
-
-
Save jesseeproductions/83e59e6124cc87a54add to your computer and use it in GitHub Desktop.
Events Calednar Pro List Widget Modified and Styled for to look like the Mini Calendar List
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Events Pro List Widget Modified and Styled for to look like the Mini Calendar List | |
* The Events Calendar Pro @3.8 | |
* | |
* 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 | |
* | |
*/ | |
if ( !defined('ABSPATH') ) die('-1'); | |
// Have taxonomy filters been applied? | |
$filters = json_decode( $filters, true ); | |
// Is the filter restricted to a single taxonomy? | |
$single_taxonomy = ( is_array( $filters ) && 1 === count( $filters ) ); | |
$single_term = false; | |
// Pull the actual taxonomy and list of terms into scope | |
if ( $single_taxonomy ) foreach ( $filters as $taxonomy => $terms ); | |
// If we have a single taxonomy and a single term, the View All link should point to the relevant archive page | |
if ( $single_taxonomy && 1 === count( $terms ) ) { | |
$link_to_archive = true; | |
$link_to_all = get_term_link( absint( $terms[0] ), $taxonomy ); | |
} | |
// Otherwise link to the main events page | |
else { | |
$link_to_archive = false; | |
$link_to_all = tribe_get_events_link(); | |
} | |
// Check if any posts were found | |
if ( $posts ): | |
?> | |
<?php | |
foreach( $posts as $post ) : | |
setup_postdata( $post ); | |
$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; | |
?> | |
<div class="tribe-list-event-mini-styled 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_i18n( 'D', $postDate ), $postDate, $class ); ?></span> | |
<span | |
class="list-daynumber"><?php echo apply_filters( 'tribe-mini_helper_tribe_events_ajax_list_daynumber', date_i18n( 'd', $postDate ), $postDate, $class ); ?></span> | |
</div> | |
<div class="list-info"> | |
<?php do_action( 'tribe_events_list_widget_before_the_event_title' ); ?> | |
<h2><a href="<?php echo tribe_get_event_link(); ?>"><?php echo $post->post_title; ?></a></h2> | |
<?php do_action( 'tribe_events_list_widget_after_the_event_title' ); ?> | |
<?php do_action( 'tribe_events_list_widget_before_the_meta' ) ?> | |
<?php if ( $cost && tribe_get_cost() != '' ) { ?> | |
<span class="tribe-list-event-mini-styled-cost"><?php echo tribe_get_cost( null, true ); ?></span> | |
<div class="tribe-events-divider ">|</div> | |
<?php } ?> | |
<?php echo tribe_events_event_schedule_details(); ?> | |
<div class="tribe-events-event-details"> | |
<?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() != '' ) { ?> | |
<div class="tribe-organizer-wrap"><?php _e( 'Organizer:', 'tribe-events-calendar-pro' ); ?> | |
<span class="tribe-organizer"><?php echo tribe_get_organizer_link(); ?></span></div> | |
<?php } ?> | |
<?php if ( $phone && tribe_get_phone() != '' ) { ?> | |
<span class="tel"><?php echo tribe_get_phone(); ?></span> | |
<?php } ?> | |
</div> | |
</div> | |
<?php do_action( 'tribe_events_list_widget_after_the_meta' ) ?> | |
</div> | |
<?php | |
endforeach; | |
?> | |
<p class="tribe-events-widget-link"> | |
<a href="<?php esc_attr_e( esc_url( $link_to_all ) ) ?>" rel="bookmark"> | |
<?php _e( 'View More…', 'tribe-events-calendar-pro' ) ?> | |
</a> | |
</p> | |
<?php | |
// No Events were Found | |
else: | |
?> | |
<p><?php _e( 'There are no upcoming events at this time.', 'tribe-events-calendar' ) ?></p> | |
<?php | |
endif; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment