From 3cbed34ba279431905bf47da9e88476bd4c03cd0 Mon Sep 17 00:00:00 2001 From: Robin Cornett Date: Sun, 12 May 2019 17:46:49 -0400 Subject: [PATCH] Remove unnecessary image div --- ...ass-displayfeaturedimagegenesis-output.php | 11 ++++--- .../css/display-featured-image-genesis.css | 2 +- sass/display-featured-image-genesis.scss | 32 +++++++++---------- 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/includes/class-displayfeaturedimagegenesis-output.php b/includes/class-displayfeaturedimagegenesis-output.php index 4597a81..f0336b3 100644 --- a/includes/class-displayfeaturedimagegenesis-output.php +++ b/includes/class-displayfeaturedimagegenesis-output.php @@ -88,7 +88,7 @@ class Display_Featured_Image_Genesis_Output { * @since 2.6.0 */ public function add_inline_style() { - $css = sprintf( '.big-leader, .big-leader__image img { max-height: %spx; }', $this->setting['max_height'] ); + $css = sprintf( '.big-leader, .big-leader--scriptless img { max-height: %spx; }', $this->setting['max_height'] ); wp_add_inline_style( 'displayfeaturedimage-style', wp_strip_all_tags( $css ) ); } @@ -208,6 +208,10 @@ class Display_Featured_Image_Genesis_Output { $class .= ' big-leader--scriptless'; } echo '
'; + $image = $this->get_banner_image(); + if ( $setting['scriptless'] ) { + echo $image; + } echo '
'; do_action( 'display_featured_image_genesis_before_title' ); @@ -229,10 +233,7 @@ class Display_Featured_Image_Genesis_Output { // close wrap echo '
'; - $image = $this->get_banner_image(); - if ( $setting['scriptless'] ) { - printf( '
%s
', $image ); - } else { + if ( ! $setting['scriptless'] ) { printf( '', $image ); } diff --git a/includes/css/display-featured-image-genesis.css b/includes/css/display-featured-image-genesis.css index 249ff09..1ebd93d 100644 --- a/includes/css/display-featured-image-genesis.css +++ b/includes/css/display-featured-image-genesis.css @@ -1 +1 @@ -.has-leader .site-inner{margin-top:0}.big-leader{overflow:hidden;max-height:600px;position:relative}.big-leader.--scriptless{height:auto}.big-leader__image img{-o-object-fit:cover;object-fit:cover}.big-leader .wrap{position:absolute;right:0;bottom:0;left:0;width:100%;z-index:1}.big-leader .entry-title.featured-image-overlay,.big-leader .archive-title.featured-image-overlay{color:#fff;text-align:center}.big-leader .excerpt,.big-leader .archive-description{margin-bottom:24px;padding:24px;background:rgba(255,255,255,.85)}.big-leader p{margin-top:18px;margin-bottom:0}.home .big-leader p{margin-top:0}.home .big-leader p:last-child{margin-bottom:0}.big-leader .excerpt .entry-title,.big-leader .archive-description .archive-title{margin-bottom:0}.backstretch.no-js{max-height:600px}img.featured{max-width:100%}@media only screen and (max-width: 768px){.big-leader,.backstretch.no-js{max-height:300px}.big-leader--scriptless,.backstretch.no-js--scriptless{height:auto}} \ No newline at end of file +.has-leader .site-inner{margin-top:0}.big-leader{overflow:hidden;max-height:600px;position:relative}.big-leader .wrap{position:absolute;right:0;bottom:0;left:0;width:100%;z-index:1}.big-leader--scriptless{height:auto}.big-leader--scriptless img{display:block;-o-object-fit:cover;object-fit:cover}.big-leader .entry-title.featured-image-overlay,.big-leader .archive-title.featured-image-overlay{color:#fff;text-align:center}.big-leader .excerpt,.big-leader .archive-description{margin-bottom:24px;padding:24px;background:rgba(255,255,255,.85)}.big-leader p{margin-top:18px;margin-bottom:0}.home .big-leader p{margin-top:0}.home .big-leader p:last-child{margin-bottom:0}.big-leader .excerpt .entry-title,.big-leader .archive-description .archive-title{margin-bottom:0}.backstretch.no-js{max-height:600px}img.featured{max-width:100%}@media only screen and (max-width: 768px){.big-leader,.big-leader--scriptless,.backstretch.no-js{max-height:300px}} \ No newline at end of file diff --git a/sass/display-featured-image-genesis.scss b/sass/display-featured-image-genesis.scss index bcc803a..90805f7 100644 --- a/sass/display-featured-image-genesis.scss +++ b/sass/display-featured-image-genesis.scss @@ -7,14 +7,6 @@ max-height: 600px; position: relative; - &.--scriptless { - height: auto; - } - - &__image img { - object-fit: cover; - } - .wrap { position: absolute; right: 0; @@ -24,10 +16,21 @@ z-index: 1; } - .entry-title.featured-image-overlay, - .archive-title.featured-image-overlay { - color: #fff; - text-align: center; + &--scriptless { + height: auto; + + img { + display: block; + object-fit: cover; + } + } + + .entry-title, + .archive-title { + &.featured-image-overlay { + color: #fff; + text-align: center; + } } .excerpt, @@ -69,11 +72,8 @@ img.featured { @media only screen and (max-width: 768px) { .big-leader, + .big-leader--scriptless, .backstretch.no-js { max-height: 300px; - - &--scriptless { - height: auto; - } } }