Created
January 14, 2016 16:36
-
-
Save anonymous/30bd53537beeb99932f2 to your computer and use it in GitHub Desktop.
This file contains 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
<div id="eventsHome"> | |
<?php | |
// Ensure the global $post variable is in scope | |
global $post; | |
// Retrieve the next 5 upcoming events | |
$events = tribe_get_events( array( | |
'posts_per_page' => 5, | |
'start_date' => new DateTime() | |
) ); ?> | |
<div class="events-header"> | |
<h4 class="widget-text">Coming Events</h4> | |
<p>Most of these events are free, open to the public, and part of our residency programs. Click through for complete details. <a href="#">Link to past events</a></p> | |
</div> | |
<?php | |
// Loop through the events: set up each one as | |
// the current post then use template tags to | |
// display the title and content | |
foreach ( $events as $post ) : | |
setup_postdata( $post ); | |
// Get event link | |
$event_link = esc_url( tribe_get_event_link() ); | |
// Get specific custom fields | |
$fields = tribe_get_custom_fields(); | |
$event_type = $fields["Event Type"]; ?> | |
<div class="single-event-wrapper"> | |
<div class="image-column"> | |
<?php echo tribe_event_featured_image(); ?> | |
</div> | |
<div class="info-column"> | |
<div class="event-title-home"> | |
<a href="<?php echo $event_link ?>" class="event-title-link" rel="bookmark"> | |
<?php the_title(); ?> | |
</a> | |
</div> | |
<div class="event-date-home"> | |
<?php echo tribe_get_start_date(); ?> | |
</div> | |
<div class="event-location-home"> | |
<?php echo tribe_get_venue(); ?> | |
</div> | |
<div class="event-description-wrapper"> | |
<span class="event-type"> | |
<?php echo $event_type; ?> | |
</span> | |
<span class="event-description-home"> | |
<?php the_excerpt(); ?> | |
</span> | |
<a href="<?php echo $event_link ?>" class="tribe-events-read-more-link" rel="bookmark">more</a> | |
</div> | |
</div> | |
</div> | |
<?php endforeach ?> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment