/** * Generate a caption for the announcement banner image. * Note: Pulls the caption from the image caption meta data. * * @return string Announcement banner image caption if it exists, else null. */ function timeline_express_after_image_caption() { global $post; if ( empty( $post->ID ) ) { return; } $announcement_image_id = get_post_meta( $post->ID, 'announcement_image_id', true ); if ( ! $announcement_image_id ) { return; } $caption = get_the_excerpt( $announcement_image_id ); if ( ! $caption ) { return; } printf( '<figcaption class="banner-caption">%s</figcaption>', esc_html( $caption ) ); } add_action( 'timeline-express-after-image', 'timeline_express_after_image_caption' );