From: Laury GvR Date: Tue, 9 Feb 2016 20:46:43 +0000 (-0500) Subject: Re-implemented parent post featured inheritance X-Git-Tag: v1.0.10^2 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=2d9a3a26c7ad11737241818218ba60d43b251098;p=WP-Themes%2Fsaultstemarie.git Re-implemented parent post featured inheritance --- 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 {