Can’t access the post ID of custom post type in the Post Carousel via shortcode

[ad_1]

I am displaying a custom post type (The Events Calendar event) using the Post Carousel using a simple Post Template I have created. Inside the post template I am trying to use the following shortcode to display the formatted start date of the event:

add_shortcode( 'ccc_event_date_and_time', 'event_date_and_time' );
function event_date_and_time( $atts ) {
return do_shortcode("[tribe_formatted_event_date id=".get_the_ID()." format=\"F j, Y, \a\t g:ia T\"]");
}

However, the get_the_ID() returns the page ID the carousel is on instead of the ID of the event. I have also tried $post->ID and other methods, but they all return the page ID. How might I be able to access the ID of the post the carousel is displaying?

I am using WordPress 6.4.3 with the Twenty Twenty-Four theme and GetWid v2.0.5. Thanks for any help you can provide.

Doug

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer