Skip to content

Commit 4c0cea0

Browse files
committed
Prevent error on failed demo installs
Signed-off-by: Kev Provance <[email protected]>
1 parent f73f9d6 commit 4c0cea0

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

redux-core/inc/fields/gallery/class-redux-gallery.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,14 @@ public function render() {
3535

3636
foreach ( $ids as $attachment_id ) {
3737
$img = wp_get_attachment_image_src( $attachment_id );
38-
$alt = wp_prepare_attachment_for_js( $attachment_id );
39-
$alt = $alt['alt'] ?? '';
38+
if ( ! false === $img ) {
39+
$alt = wp_prepare_attachment_for_js( $attachment_id );
40+
$alt = $alt['alt'] ?? '';
4041

41-
echo '<a class="of-uploaded-image" href="' . esc_url( $img[0] ) . '">';
42-
echo '<img class="redux-option-image" id="image_' . esc_attr( $this->field['id'] ) . '_' . esc_attr( $attachment_id ) . '" src="' . esc_url( $img[0] ) . '" alt="' . esc_attr( $alt ) . '" target="_blank" rel="external" />';
43-
echo '</a>';
42+
echo '<a class="of-uploaded-image" href="' . esc_url( $img[0] ) . '">';
43+
echo '<img class="redux-option-image" id="image_' . esc_attr( $this->field['id'] ) . '_' . esc_attr( $attachment_id ) . '" src="' . esc_url( $img[0] ) . '" alt="' . esc_attr( $alt ) . '" target="_blank" rel="external" />';
44+
echo '</a>';
45+
}
4446
}
4547
}
4648

0 commit comments

Comments
 (0)