Add cache busting for featured images
authorLaury GvR <laury@gaslightmedia.com>
Tue, 5 Nov 2019 18:46:19 +0000 (13:46 -0500)
committerLaury GvR <laury@gaslightmedia.com>
Tue, 5 Nov 2019 18:46:19 +0000 (13:46 -0500)
functions.php

index 9ee2ef2..3e66552 100644 (file)
@@ -235,7 +235,7 @@ function glm_get_header() {
         } else {
             $featured_image_url = $image_data[0];
         }
-        echo ' style="background-image: url('.$featured_image_url.');padding:0;padding-bottom:16%;background-position:center center;background-size: cover;background-repeat:no-repeat;max-height: 300px "';
+        echo ' style="background-image: url('.$featured_image_url.'?v=1.0);padding:0;padding-bottom:16%;background-position:center center;background-size: cover;background-repeat:no-repeat;max-height: 300px "';
         
     } else if ( is_product_category() ){
         
@@ -243,14 +243,14 @@ function glm_get_header() {
             $tagID = $tag->term_id;
             $thumbnail = z_taxonomy_image_url( $tagID);
         
-            echo ' style="background-image: url('.$thumbnail.');padding:0;padding-bottom:20%;background-position:center center;background-size: cover;background-repeat:no-repeat;max-height: 370px; "';
+            echo ' style="background-image: url('.$thumbnail.'?v=1.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(100), "full");
 //            echo ' style="background-image: url('.$image_data[0].');padding:0;padding-bottom:20%;background-position:center center;background-size: contain;background-repeat:no-repeat;max-height: 370px; "';
         
     } else if ( has_post_thumbnail($post_id) && is_post_type('page')) {
         
             $image_data = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), "full");
-            echo ' style="background-image: url('.$image_data[0].');padding:0;padding-bottom:20%;background-position:center center;background-size: 100%;background-repeat:no-repeat;max-height: 370px; "';
+            echo ' style="background-image: url('.$image_data[0].'?v=1.0);padding:0;padding-bottom:20%;background-position:center center;background-size: 100%;background-repeat:no-repeat;max-height: 370px; "';
         
     } else if ( is_product_tag() ){
         
@@ -263,10 +263,10 @@ function glm_get_header() {
                 $thumbnail = get_template_directory_uri().'/assets/default-product-featured.png';
             }
         
-            echo ' style="background-image: url('.$thumbnail.');padding:0;padding-bottom:20%;background-position:center center;background-size: cover;background-repeat:no-repeat;max-height: 370px; "';
+            echo ' style="background-image: url('.$thumbnail.'?v=1.0);padding:0;padding-bottom:20%;background-position:center center;background-size: cover;background-repeat:no-repeat;max-height: 370px; "';
             
     } else {
-            echo ' style="background-image: url('.get_template_directory_uri().'/assets/header-images-2.jpg);padding:0;padding-bottom:30%;background-position:center center;background-size:cover;background-repeat:no-repeat;max-height: 370px; "';
+            echo ' style="background-image: url('.get_template_directory_uri().'/assets/header-images-2.jpg?v=1.0);padding:0;padding-bottom:30%;background-position:center center;background-size:cover;background-repeat:no-repeat;max-height: 370px; "';
             echo ' class="no-featured"';
     }
     echo '>';