From b5c826906c2febb8b7be0c2df59551710747f4a3 Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Wed, 22 Mar 2017 13:31:56 -0400 Subject: [PATCH] changing the get_header image function to set restriction at 250px, center bottom, cover and no repeat --- functions.php | 43 +++++-------------------------------------- 1 file changed, 5 insertions(+), 38 deletions(-) diff --git a/functions.php b/functions.php index 97ffb9e..e668b3c 100644 --- a/functions.php +++ b/functions.php @@ -100,51 +100,18 @@ function glm_get_header() { global $post; $post_id = $post->ID; - // inherit featured image from parent pages - if ( $post->post_parent && !has_post_thumbnail($post->ID)){ - $post_id = $post->post_parent; - } echo '
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; "'; -// $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; "'; + if ( 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 bottom;background-size: cover;background-repeat:no-repeat;max-height: 250px; "'; - } else if ( is_product_tag() ){ - - $tag = get_queried_object(); - $tagID = $tag->term_id; - - $thumbnail = z_taxonomy_image_url( (int)$object->object_id ); - - echo ' style="background-image: url('.$thumbnail.');padding:0;padding-bottom:20%;background-position:top center;background-size: cover;background-repeat:no-repeat;max-height: 250px; "'; } else if ( !is_post_type('page') ){ - echo ' class="no-featured"'; + echo ' class="no-featured"'; } else { - echo ' style="background-image: url('.get_template_directory_uri().'/assets/interior-pg-header-image.jpg);padding:0;padding-bottom:20%;background-position:top center;background-size:cover;background-repeat:no-repeat;max-height: 250px; "'; - echo ' class="no-featured"'; + echo ' style="background-image: url('.get_template_directory_uri().'/assets/interior-pg-header-image.jpg);padding:0;padding-bottom:20%;background-position:center bottom;background-size:cover;background-repeat:no-repeat;max-height: 250px; "'; } echo '>'; echo '
'; - echo '
'; - echo '
'; - echo '
'; - echo '
'; } // // The code below is useful when you want the image to resize to -- 2.17.1