Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditionally render the featured image in the email, only if it is set. #918

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading