Skip to content

Commit 7d07728

Browse files
authored
Merge pull request #268 from BeAPI/fix/helper-image
fix (Helpers) : missing logic for default parameter
2 parents 916f0fc + 991a17c commit 7d07728

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Diff for: inc/Helpers/Formatting/Image.php

+10-4
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,19 @@ function get_the_image( int $image_id, array $attributes, array $settings = [] )
4848
$settings = wp_parse_args(
4949
$settings,
5050
[
51-
'size' => 'thumbnail',
52-
'before' => '',
53-
'after' => '',
51+
'size' => 'thumbnail',
52+
'before' => '',
53+
'after' => '',
54+
'default' => false,
5455
]
5556
);
5657

57-
$settings = apply_filters( 'bea_theme_framework_the_image_settings', $settings, $image_id, $attributes );
58+
$settings = apply_filters( 'bea_theme_framework_the_image_settings', $settings, $image_id, $attributes );
59+
60+
if ( 0 === $image_id && ! $settings['default'] ) {
61+
return '';
62+
}
63+
5864
$image_markup = \wp_get_attachment_image(
5965
$image_id,
6066
$settings['size'],

0 commit comments

Comments
 (0)