Skip to content

Commit 296abc6

Browse files
fix: edge case for thumbnail inheritance on frontend
1 parent bcbf500 commit 296abc6

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

includes/gutenberg/feedzy-rss-feeds-loop-block.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,21 @@ public function render_callback( $attributes, $content ) {
128128
'refresh' => '12_hours',
129129
);
130130

131-
$query = isset( $attributes['query'] ) ? wp_parse_args( $attributes['query'], $default_query ) : $default_query;
132-
$filters = isset( $attributes['conditions'] ) ? $attributes['conditions'] : array();
133-
$thumb = 'auto';
131+
$query = isset( $attributes['query'] ) ? wp_parse_args( $attributes['query'], $default_query ) : $default_query;
132+
$filters = isset( $attributes['conditions'] ) ? $attributes['conditions'] : array();
133+
$thumb = 'auto';
134+
$default_thumbnail = '';
134135

135136
if ( isset( $attributes['thumb'] ) && ! empty( $attributes['thumb'] ) ) {
136137
$thumb = $attributes['thumb'];
138+
139+
if (
140+
'yes' === $thumb &&
141+
isset( $attributes['fallbackImage'], $attributes['fallbackImage']['url'] ) &&
142+
! empty( $attributes['fallbackImage']['url'] )
143+
) {
144+
$default_thumbnail = $attributes['fallbackImage']['url'];
145+
}
137146
}
138147

139148
$options = array(
@@ -145,7 +154,7 @@ public function render_callback( $attributes, $content ) {
145154
'keywords_ban' => '',
146155
'columns' => '1',
147156
'thumb' => $thumb,
148-
'default' => '',
157+
'default' => $default_thumbnail,
149158
'title' => '',
150159
'meta' => 'yes',
151160
'multiple_meta' => 'no',

0 commit comments

Comments
 (0)