From 4da66b80eea8e3da90fe9385c1f816d1344e89ce Mon Sep 17 00:00:00 2001 From: Robin Cornett Date: Mon, 27 Apr 2015 11:26:29 -0400 Subject: [PATCH] fix archive thumbnails If a post has an image attached (uploaded to that post), Genesis uses that for the archive, which results in a duplicate image. This now outputs a term/CPT image only if the post has no attached image. --- includes/helper-functions.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/includes/helper-functions.php b/includes/helper-functions.php index 8535d8f..7403867 100644 --- a/includes/helper-functions.php +++ b/includes/helper-functions.php @@ -153,7 +153,16 @@ function display_featured_image_genesis_add_archive_thumbnails() { return; } - if ( has_post_thumbnail() ) { + $args = array( + 'order' => 'ASC', + 'orderby' => 'menu_order', + 'post_mime_type' => 'image', + 'post_parent' => $post_id ? $post_id : get_the_ID(), + 'post_type' => 'attachment', + ); + $attached_images = get_children( $args ); + + if ( has_post_thumbnail() || $attached_images ) { return; }