Hi Guys,
I have a site i’m building which is based around a program of Events for a Festival.
I’m using Custom Post Type UI to create the custom Events post type, and Advanced Custom Fields to create specific fields (date, time, venue etc) for the events.
For the events archive page I am using WP Show Posts to show the list of events and am using a function hook the custom fields in to those listings (see https://3bm.net.au/events-program/).
I am now trying to do the same thing for the single post page (which i’m not using WPSP for) but am struggling with the code, see below. Any idea what i am doing wrong?
add_action( 'after_entry_header', 'bm_add_after_entry_header' );
function bm_add_after_entry_header() {
$date = get_post_meta( get_the_ID(), 'event_date', true );
$time = get_post_meta( get_the_ID(), 'event_time', true );
if ( isset( $date ) && '' !== $date ) {
if ( isset( $time ) && '' !== $time ) {
echo '<p>'.$date.' / '.$time.'</p>';
} else {
echo '<p>'.$date.'</p>';
}
}
}
Thank you,
Ben