Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // 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();
- post_class($alt_text,$post->ID);
- $class = ob_get_contents();
- ob_end_clean();
- ?>
- <?php
- //check if $i is zero and if so we're looking at the first record
- if($i == 0) { ?>
- <div class="event">
- <?php if(has_post_thumbnail($post->ID, 'thumbnail')):
- $image_id = get_post_thumbnail_id($post->ID);
- $image_url = wp_get_attachment_image_src($image_id, 'thumbnail', true); ?>
- <a href="<?php echo get_permalink($post->ID) ?>" class="post-thumb"><img src="<?php echo $image_url[0]; ?>" alt="<?php echo $post->post_title ?>" /></a>
- <?php endif; ?>
- <a href="<?php echo get_permalink($post->ID) ?>"><?php echo $post->post_title ?></a>
- </div>
- <div class="when">
- <?php
- echo tribe_get_start_date( $post->ID, isset($start) ? $start : null );
- if($event->AllDay && $start)
- echo ' <small>('.__('All Day','tribe-events-calendar-pro').')</small>';
- ?>
- </div>
- <div class="loc">
- <?php
- if ( tribe_get_city() != '' ) {
- echo tribe_get_city() . ', ';
- }
- if (tribe_get_region() != '') {
- echo tribe_get_region() . ', ';
- }
- if (tribe_get_country() != '') {
- echo tribe_get_country();
- }
- ?>
- </div>
- <div class="event_body">
- <?php the_content('... More');?>
- </div>
- <?php $alt_text = ( empty( $alt_text ) ) ? 'alt' : ''; ?>
- <?php } else { ?>
- <div class="event">
- <a href="<?php echo get_permalink($post->ID) ?>"><?php echo $post->post_title ?></a>
- </div>
- <div class="when">
- <?php
- echo tribe_get_start_date( $post->ID, isset($start) ? $start : null );
- if($event->AllDay && $start)
- echo ' <small>('.__('All Day','tribe-events-calendar-pro').')</small>';
- ?>
- </div>
- <div class="loc">
- <?php
- if ( tribe_get_city() != '' ) {
- echo tribe_get_city() . ', ';
- }
- if (tribe_get_region() != '') {
- echo tribe_get_region() . ', ';
- }
- if (tribe_get_country() != '') {
- echo tribe_get_country();
- }
- ?>
- </div>
- <div class="event_body">
- <?php the_content('... More');?>
- </div>
- <?php $alt_text = ( empty( $alt_text ) ) ? 'alt' : ''; ?>
- <?php }
- $i++;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement