Skip to content

Commit

Permalink
Conditionally render the featured image in the email, only if it is set.
Browse files Browse the repository at this point in the history
  • Loading branch information
carstingaxion committed Sep 26, 2024
1 parent 4b89474 commit d4133af
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions includes/templates/admin/emails/event-email.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
return;
}

$gatherpress_event = new Event( $event_id );
$gatherpress_venue = $gatherpress_event->get_venue_information()['name'];
$gatherpress_event = new Event( $event_id );
$gatherpress_event_image = get_the_post_thumbnail_url( $event_id, 'full' );
$gatherpress_venue = $gatherpress_event->get_venue_information()['name'];

?>

Expand All @@ -36,8 +37,10 @@
<?php echo wp_kses( nl2br( $message ), array( 'br' => array() ) ); ?>
</p>
<?php endif; ?>
<!-- Feature Image -->
<img src="<?php echo esc_url( get_the_post_thumbnail_url( $event_id, 'full' ) ); ?>" alt="<?php esc_attr_e( 'Event Image', 'gatherpress' ); ?>" style="max-width: 100%;">
<?php if ( $gatherpress_event_image ) : ?>
<!-- Feature Image -->
<img src="<?php echo esc_url( $gatherpress_event_image ); ?>" alt="<?php esc_attr_e( 'Event Image', 'gatherpress' ); ?>" style="max-width: 100%;">
<?php endif; ?>

<!-- Event Title -->
<h1 style="text-align: center;"><?php echo wp_kses_post( get_the_title( $event_id ) ); ?></h1>
Expand Down

0 comments on commit d4133af

Please sign in to comment.