fixing background images so that they don't tile.
authorAnthony Talarico <talarico@gaslightmedia.com>
Tue, 11 Dec 2018 14:01:46 +0000 (09:01 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Tue, 11 Dec 2018 14:01:46 +0000 (09:01 -0500)
adding bg cover and no repeat to the background iamges for posts and pages

functions.php
home.php
single.php

index 15e3c13..efb1852 100644 (file)
@@ -136,9 +136,9 @@ 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].'\')"></div>';
+        $imageUrl = '<div class="featured-image" style="background: url(\''.$image_data[0].'\') no-repeat center center / cover"></div>';
     } else {
-        $imageUrl = '<div class="featured-image" style="background: url(\''.get_template_directory_uri().'/assets/backgrounds/Default.jpg\')"></div>';
+        $imageUrl = '<div class="featured-image" style="background: url(\''.get_template_directory_uri().'/assets/backgrounds/Default.jpg\') no-repeat center center /cover"></div>';
     }
     return $imageUrl; 
 }
index 72d2d57..b9f464a 100644 (file)
--- a/home.php
+++ b/home.php
@@ -1,5 +1,5 @@
 <?php get_header(); ?>
-    <div class="featured-image" style="background: url(<?php echo get_template_directory_uri(); ?>/assets/backgrounds/Default.jpg)"></div>    
+    <div class="featured-image" style="background: url(<?php echo get_template_directory_uri(); ?>/assets/backgrounds/Default.jpg) no-repeat center center / cover"></div>    
         <main class="blog-home">    
             <div class="row">
                 <div class="small-11 small-centered columns"> 
index 2b581ad..95e5c26 100644 (file)
@@ -1,5 +1,5 @@
 <?php get_header(); ?>
-<div class="featured-image" style="background: url(<?php echo get_template_directory_uri(); ?>/assets/backgrounds/Default.jpg)"></div>    
+<div class="featured-image" style="background: url(<?php echo get_template_directory_uri(); ?>/assets/backgrounds/Default.jpg) no-repeat center center / cover;"></div>    
     <main class="blog-single">    
         <div class="row">
             <div id="blog-posts-over" class="small-12 medium-9 columns">