Skip to content

Commit

Permalink
adds better conditional for missing attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
bacoords committed May 9, 2023
1 parent 934b717 commit 85fe960
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions build/render.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@
*
* @package wpdev
*/

?>

<div <?php echo get_block_wrapper_attributes(); ?> tabindex="0">
<?php
if ( $attributes['foregroundImage'] ) {
if ( isset( $attributes['foregroundImage'] ) && $attributes['foregroundImage'] ) {
echo wp_get_attachment_image( $attributes['foregroundImage'], 'full' );
}
if ( $attributes['backgroundImage'] ) {
if ( isset( $attributes['backgroundImage'] ) && $attributes['backgroundImage'] ) {
echo wp_get_attachment_image( $attributes['backgroundImage'], 'full' );
}
?>
Expand Down
5 changes: 2 additions & 3 deletions src/render.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@
*
* @package wpdev
*/

?>

<div <?php echo get_block_wrapper_attributes(); ?> tabindex="0">
<?php
if ( $attributes['foregroundImage'] ) {
if ( isset( $attributes['foregroundImage'] ) && $attributes['foregroundImage'] ) {
echo wp_get_attachment_image( $attributes['foregroundImage'], 'full' );
}
if ( $attributes['backgroundImage'] ) {
if ( isset( $attributes['backgroundImage'] ) && $attributes['backgroundImage'] ) {
echo wp_get_attachment_image( $attributes['backgroundImage'], 'full' );
}
?>
Expand Down

0 comments on commit 85fe960

Please sign in to comment.