From 3d89a872adbfcb174723f0fdf46a0a3280392f59 Mon Sep 17 00:00:00 2001 From: pederan Date: Tue, 26 Jun 2018 13:46:27 +0200 Subject: [PATCH 1/2] Fix issue#27 - Not render content div if no content --- assets/template.php | 87 +++++++++++++++++++-------------------------- 1 file changed, 37 insertions(+), 50 deletions(-) diff --git a/assets/template.php b/assets/template.php index 5edf9a1..7bd3ed0 100644 --- a/assets/template.php +++ b/assets/template.php @@ -28,63 +28,50 @@
main_image ) ) { - echo wp_get_attachment_image( - $this->main_image['id'], - $this->main_image['size'], - $this->main_image['icon'], - $this->main_image['attr'] - ); + echo wp_get_attachment_image( $this->main_image['id'], $this->main_image['size'], $this->main_image['icon'], $this->main_image['attr'] ); } ?>
-
-
- image ) ) { - echo wp_get_attachment_image( - $this->image['id'], - $this->image['size'], - $this->image['icon'], - $this->image['attr'] - ); - } + image ) || ! empty( $this->tagline ) || ! empty( $this->heading ) || ! empty( $this->content ) || ! empty( $this->call_to_actions ) ) : ?> +
+
+ image ) ) { + echo wp_get_attachment_image( $this->image['id'], $this->image['size'], $this->image['icon'], $this->image['attr'] ); + } - if ( ! empty( $this->tagline ) ) { - printf( - '
%s
', - esc_html( - $this->tagline - ) - ); - } + if ( ! empty( $this->tagline ) ) { + printf( '
%s
', esc_html( $this->tagline ) ); + } - if ( ! empty( $this->heading ) ) { - hogan_component( - 'heading', [ - 'title' => $this->heading, - ] - ); - } + if ( ! empty( $this->heading ) ) { + hogan_component( + 'heading', [ + 'title' => $this->heading, + ] + ); + } - if ( ! empty( $this->content ) ) { - echo wp_kses( - $this->content, [ - 'p' => [], - 'br' => [], - ] - ); - } + if ( ! empty( $this->content ) ) { + echo wp_kses( + $this->content, [ + 'p' => [], + 'br' => [], + ] + ); + } - if ( ! empty( $this->call_to_actions ) ) { - echo '
'; - foreach ( $this->call_to_actions as $button ) { - echo ''; - hogan_component( 'button', $button ); - echo ''; + if ( ! empty( $this->call_to_actions ) ) { + echo '
'; + foreach ( $this->call_to_actions as $button ) { + echo ''; + hogan_component( 'button', $button ); + echo ''; + } + echo '
'; } - echo '
'; - } - ?> + ?> +
-
+
From 6cfdad07516f1b16984916a07cae7c82c8d7820c Mon Sep 17 00:00:00 2001 From: pederan Date: Tue, 26 Jun 2018 13:55:53 +0200 Subject: [PATCH 2/2] Editor style cleanup --- assets/template.php | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/assets/template.php b/assets/template.php index 7bd3ed0..ccc8512 100644 --- a/assets/template.php +++ b/assets/template.php @@ -28,7 +28,12 @@
main_image ) ) { - echo wp_get_attachment_image( $this->main_image['id'], $this->main_image['size'], $this->main_image['icon'], $this->main_image['attr'] ); + echo wp_get_attachment_image( + $this->main_image['id'], + $this->main_image['size'], + $this->main_image['icon'], + $this->main_image['attr'] + ); } ?>
@@ -37,11 +42,21 @@
image ) ) { - echo wp_get_attachment_image( $this->image['id'], $this->image['size'], $this->image['icon'], $this->image['attr'] ); + echo wp_get_attachment_image( + $this->image['id'], + $this->image['size'], + $this->image['icon'], + $this->image['attr'] + ); } if ( ! empty( $this->tagline ) ) { - printf( '
%s
', esc_html( $this->tagline ) ); + printf( + '
%s
', + esc_html( + $this->tagline + ) + ); } if ( ! empty( $this->heading ) ) {