From 5042925ccd3a0ee3956ccb515fd479eaba64e580 Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Tue, 19 Jan 2016 13:46:45 -0500 Subject: [PATCH] added code to functions php to inherit featured image from parent page --- functions.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/functions.php b/functions.php index 8d32e7b..ec062cf 100644 --- a/functions.php +++ b/functions.php @@ -80,10 +80,18 @@ function glm_site_scripts() /* Header for posts*/ function glm_get_header() { + global $post; + echo 'post_parent ){ + $post_id = $post->post_parent; + } + else + $post_id = $post->ID; - if (has_post_thumbnail()) { - $image_data = wp_get_attachment_image_src(get_post_thumbnail_id(), "full"); + if (has_post_thumbnail($post_id)) { + $image_data = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), "full"); echo ' style="background-image: url('.$image_data[0].');height:0;padding:0;padding-bottom:30%;background-position:center center;background-size: 100%;background-repeat:no-repeat;max-height: 420px;min-height: 150px; "'; } else { echo ' style="background-image: url('.get_template_directory_uri().'/assets/things-to-do.jpg);height:0;padding:0;padding-bottom:30%;background-position:center center;background-size: 100%;background-repeat:no-repeat;max-height: 420px; min-height: 150px;"'; @@ -137,4 +145,6 @@ function mytheme_search_loop() { add_action('thematic_searchloop', 'mytheme_search_loop'); // End of the Contextual/Highlight Search functions //add_image_size('glm_blocks', '570', '280', true); + + ?> -- 2.17.1