Tribe Events Calendar – Custom Date Format in Loop

Use the below example to custom format the date displayed when querying Tribe events. 

<?php $events = tribe_get_events( array(
    'posts_per_page' => 3,
    'start_date' => current_time( 'Y-m-d' ),
) ); 

foreach($events as $post) : setup_postdata($post); ?>
	<li>
		<?php if(has_post_thumbnail()) { ?>
			<a href="<?php the_permalink(); ?>">
				<div class="event_content with_thumb">
					<div class="event_image"></div>
					<div class="event_info">
						<h2 class="event_date"><?php echo tribe_get_start_date( $post, false, 'M d' ); ?></h2>
						<h3 class="event_title"><?php the_title(); ?></h3>
					</div>
				</div>
			</a>
		<?php } else { ?>
			<a href="<?php the_permalink(); ?>">
				<div class="event_content">
					<div class="event_info">
						<h2 class="event_date"><?php echo tribe_get_start_date( $post, false, 'M d' ); ?></h2>
						<h3 class="event_title"><?php the_title(); ?></h3>
					</div>
				</div>
			</a>
		<?php } ?>
	</li>
<?php endforeach; wp_reset_postdata(); ?>


Alternate format example:

<?php echo tribe_get_start_date( $post, false, 'l, F j, Y' ); ?>

Source.

Leave a Reply

katherine as a flat graphic icon

About Me

I’m an African / Ojibwe First Nations Web Developer living in Winnipeg, Manitoba.

Visit the Tips and Blog to see what I’m working on.