Skip to content

Instantly share code, notes, and snippets.

@trishasalas
Created April 21, 2017 00:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trishasalas/fb531e3161771474a31c755215742796 to your computer and use it in GitHub Desktop.
Save trishasalas/fb531e3161771474a31c755215742796 to your computer and use it in GitHub Desktop.
These functions should be used in conjunction with the list view widget in Events Calendar PRO
function tribe_upcoming_events() {
$front_page_sidebar = get_post_meta( get_the_ID(), 'tribe_events', true );
if ( ! is_active_sidebar( $front_page_sidebar ) ) {
return;
}
add_action( 'tribe_events_list_widget_after_the_event_title', 'tribe_event_start_date' );
echo '<div class="events"><div class="events-content">';
add_action( 'tribe_events_list_widget_before_the_event_title', 'tribe_get_events_featured_image' );
add_action( 'tribe_events_list_widget_after_the_meta', 'tribe_get_venue_details' );
dynamic_sidebar( $front_page_sidebar );
echo '</div></div>';
}
function tribe_get_events_featured_image() {
$featured_events_thumb = tribe_event_featured_image( get_the_ID(), 'full', false );
if ( $featured_events_thumb ) {
echo tribe_event_featured_image( get_the_ID(), 'full', false );
} else {
?>
<img src="<?php echo get_template_directory_uri();?>/assets/img/featured-event-<?php echo rand( 1,3 ); ?>.jpg">
<?php
}
}
function tribe_event_start_date() {
$start_date = get_post_meta( get_the_ID(), '_EventStartDate', true );
$month = date_i18n( 'M', strtotime( $start_date ) );
$day = date_i18n( 'j', strtotime( $start_date ) );
if ( ! empty( $start_date ) ) {
echo '<div class="tribe-event-data">';
echo '<div class="tribe-event-month">' . $month . '</div>';
echo '<div class="tribe-event-day">' . $day . '</div>';
echo '</div>';
}
}
function tribe_get_venue_details() {
$venue_name = tribe_get_meta( 'tribe_event_venue_name' );
if ( ! empty( $venue_name ) ) {
$venue_name_html = str_replace( '%s', 'tribe-venue', $venue_name );
echo $venue_name_html;
}
}
.events {
background: #f2f2f2;
padding: 30px 0;
.events-content {
@include container(740px);
}
.widget-title {
color: #666666;
text-align: center;
font-size: 38px;
margin-bottom: 1em;
}
.tribe-list-widget {
@include susy-clearfix;
margin: 0;
padding: 0;
}
.tribe-events-adv-list-widget {
@include susy-clearfix;
margin: 0;
padding: 0;
ol {
margin: 0;
padding: 0;
}
.tribe-events-category-tribe {
background: $blue;
.tribe-event-title {
background: darken($blue, 5%);
}
> .tribe-event-data {
background: $blue;
}
}
.tribe-events-category-elementary {
background: $purple;
.tribe-event-title {
background: darken($purple, 5%);
}
> .tribe-event-data {
background: $purple;
}
}
.tribe-events-category-preschool {
background: $green;
.tribe-event-title {
background: darken($green, 5%);
}
> .tribe-event-data {
background: $green;
}
}
li {
width: 28.5%;
float: left;
display: inline-block;
margin-right: 7.14%;
margin-bottom: 20px;
position: relative;
padding-bottom: 20px;
@include bp(600) {
width: 200px;
float: none;
display: block;
margin: 0 auto 20px;
position: relative;
padding-bottom: 20px;
}
&:first-of-type {
margin-left: 0;
@include bp(600) {
margin-left: auto;
}
}
&:last-of-type {
float: right;
margin-right: 0;
@include bp(600) {
float: none;
margin-right: auto;
}
}
}
.tribe-events-event-image {
margin: 0;
img {
width: 100%;
height: auto;
}
}
.tribe-event-title {
font-size: 18px;
padding: 20px;
margin: -10px 0 20px 0;
a {
color: white;
text-decoration: none;
}
}
.tribe-venue {
a {
color: white;
}
}
}
.tribe-event-data {
color: white;
position: absolute;
top: 20px;
left: 20px;
text-align: center;
padding: 10px;
font-size: 18px;
letter-spacing: 1px;
}
.tribe-event-month {
text-transform: uppercase;
}
.tribe-events-widget-link {
@include susy-clearfix;
text-align: center;
font-size: 20px;
margin-top: 30px;
margin-bottom: 1em;
a {
color: $blue;
}
}
.tribe-event-duration,
.tribe-venue {
padding: 0 20px;
color: white;
line-height: 1.8;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment