marcuszeal

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • marcuszeal
    Participant

    I’ve figured it out! The support post that suggested the code above was simply wrong for this example. The solution is to use the new tribe_get_start_date function and the date_format multiple times to echo out what you need for each. Makes sense now that I’ve said it all outloud. lol

    Here’s My Code (For the next guy!):

    
    <section class="upcoming-events">   
    <?php 
    // Ensure the global $post variable is in scope
    global $post;
     
    // Retrieve the next 3 upcoming events
    $events = tribe_get_events( array(
        'posts_per_page' => 3,
    ) );
    
    foreach ( $events as $post ) {
        setup_postdata( $post );
    	?>
    	<div class="event-list">
    		<div class="large-date">
    			<span class="month"><?php echo tribe_get_start_date ( $post, $display_time = false, $date_format = M );  ?></span>
    			<span class="day">  <?php echo tribe_get_start_date ( $post, $display_time = false, $date_format = d );  ?></span>
    			<span class="week"> <?php echo tribe_get_start_date ( $post, $display_time = false, $date_format = D );  ?></span> 
    		</div>
    		
    		<div class="event-info">	
    			<a href="<?php tribe_event_link(); ?>" class="event-link"></a>
    			<h5><?php echo "$post->post_title"; ?></h5>
    			<p class="event-date"><?php echo tribe_get_start_date( $post );  ?></p>
    		</div>
    	</div> 
    <?php 
    	}
    ?>
    
    </section>
    
    

    The important bits tho:
    <?php echo tribe_get_start_date ( $post, $display_time = false, $date_format = M ); ?>
    That “M” is displaying the truncated Month (Jan – Dec). All the formats can be found here: http://php.net/manual/en/function.date.php

Viewing 1 post (of 1 total)