Try out new default featured image for product detail pages
authorLaury GvR <laury@gaslightmedia.com>
Tue, 5 Nov 2019 13:45:01 +0000 (08:45 -0500)
committerLaury GvR <laury@gaslightmedia.com>
Tue, 5 Nov 2019 13:45:01 +0000 (08:45 -0500)
assets/default-product-featured.png [new file with mode: 0755]
assets/logo-2019-white.png [deleted file]
assets/logo-2019.png [deleted file]
functions.php

diff --git a/assets/default-product-featured.png b/assets/default-product-featured.png
new file mode 100755 (executable)
index 0000000..f024fa2
Binary files /dev/null and b/assets/default-product-featured.png differ
diff --git a/assets/logo-2019-white.png b/assets/logo-2019-white.png
deleted file mode 100644 (file)
index cb1290d..0000000
Binary files a/assets/logo-2019-white.png and /dev/null differ
diff --git a/assets/logo-2019.png b/assets/logo-2019.png
deleted file mode 100755 (executable)
index a10e502..0000000
Binary files a/assets/logo-2019.png and /dev/null differ
index 89ab15a..59933ab 100644 (file)
@@ -228,8 +228,14 @@ function glm_get_header() {
     echo '<div class="header-image-background"';
     if(is_product() || is_page(101) ){
             
-            $image_data = wp_get_attachment_image_src(get_post_thumbnail_id(101), "full");
-            echo ' style="background-image: url('.$image_data[0].');padding:0;padding-bottom:20%;background-position:center center;background-size: cover;background-repeat:no-repeat;max-height: 370px "';
+        $image_data = wp_get_attachment_image_src(get_post_thumbnail_id(101), "full");
+        
+        if (!$image_data) {
+            $featured_image_url = get_template_directory_uri().'/assets/default-product-featured.png';
+        } else {
+            $featured_image_url = $image_data[0];
+        }
+        echo ' style="background-image: url('.$featured_image_url.');padding:0;padding-bottom:20%;background-position:center center;background-size: cover;background-repeat:no-repeat;max-height: 370px "';
         
     } else if ( is_product_category() ){