Can’t access the post ID of custom post type in the Post Carousel via shortcode
-
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
- The topic ‘Can’t access the post ID of custom post type in the Post Carousel via shortcode’ is closed to new replies.