switching header image function in internal pages
authorAnthony Talarico <talarico@gaslightmedia.com>
Tue, 11 Sep 2018 18:10:24 +0000 (14:10 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Tue, 11 Sep 2018 18:10:24 +0000 (14:10 -0400)
functions.php
page.php

index b57b24d..17b08cc 100644 (file)
@@ -354,7 +354,7 @@ function glm_site_scripts()
 function glm_get_background() {
     if (has_post_thumbnail()) {
         $image_data = wp_get_attachment_image_src(get_post_thumbnail_id(), "full");
-        $imageUrl = '<div class="featured-image" style="background: url(\''.$image_data[0].'\') no-repeat scroll 0px 0px / cover;"></div>';
+        $imageUrl = "<div class='featured-image' style='background: url($image_data[0]) no-repeat scroll 0px 0px / cover;'></div";
     } else {
         $imageUrl = '';
     }
@@ -366,7 +366,7 @@ function glm_get_header() {
 
     if (has_post_thumbnail()) {
             $image_data = wp_get_attachment_image_src(get_post_thumbnail_id(), "full");
-            echo ' style="background-image: url('.$image_data[0].');height:0;padding:0;padding-bottom:20%;background-position:center center;background-size: 100%;background-repeat:no-repeat;max-height: 300px; "';
+            echo ' style="background-image: url('.$image_data[0].');height:0;padding:0;padding-bottom:20%;background-position:center center;background-size: cover;background-repeat:no-repeat;max-height: 300px; "';
     } else {
             //echo ' style="background-image: url('.get_template_directory_uri().'/assets/default-header.gif);height:0;padding:0;padding-bottom:30%;background-position:center center;background-size: 100%;background-repeat:no-repeat;max-height: 300px;"';
             echo ' class="no-featured"';
index 4e6afc4..bc46a17 100644 (file)
--- a/page.php
+++ b/page.php
@@ -1,7 +1,7 @@
 <?php get_header(); ?>
 <main class="page-inside">
     <div id="head-img">
-        <?php echo glm_get_background(); ?>
+        <?php echo glm_get_header(); ?>
     </div>
         <div id="content-wrapper">
             <div class="row">