From 2d9a3a26c7ad11737241818218ba60d43b251098 Mon Sep 17 00:00:00 2001 From: Laury GvR Date: Tue, 9 Feb 2016 15:46:43 -0500 Subject: [PATCH] Re-implemented parent post featured inheritance --- functions.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/functions.php b/functions.php index 092d849..d101bb2 100644 --- a/functions.php +++ b/functions.php @@ -100,7 +100,14 @@ function glm_site_scripts() // echo ''; //} function glm_get_featured() { - if (has_post_thumbnail()) { + 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; + } + + if (has_post_thumbnail($post_id) && (!(is_home()) ) && (!(is_single())) && (!(is_archive())) && (!(is_search()))) { $image_data = wp_get_attachment_image_src(get_post_thumbnail_id(), "full"); $imageUrl = ''; } else { -- 2.17.1