tribe_get_start_time displays the current date and time on other post types than tribe_events

i am displaying posts selected by an ACF relationship (with object format) on a page, including custom posts like tribe_events.
I want to display the date and time on the tribe_events posts, but not on the other posts. I am using this code below. It displays correctly the start date and time of the tribe_events, but it also displays the current date and time on the other posts. What can i don to have the date and time only on the tribe_events posts ? Thanks 😉

<?php
global $post;
$posts = get_field( ‘relationship’ );
if( $posts ):

foreach( $posts as $p ):
setup_postdata( $p );

// Display the date of the event
$p_event = tribe_get_start_time ( $p->ID, ‘j F à H h i’ );

if ( $p_event ) {
echo $p_event;
}
else ”;
endforeach;
endif;

?>

Read more here:: tribe_get_start_time displays the current date and time on other post types than tribe_events

Leave a Reply

Your email address will not be published. Required fields are marked *