diff --git a/includes/class-displayfeaturedimagegenesis-common.php b/includes/class-displayfeaturedimagegenesis-common.php index 60321e0..22b1e80 100644 --- a/includes/class-displayfeaturedimagegenesis-common.php +++ b/includes/class-displayfeaturedimagegenesis-common.php @@ -68,8 +68,20 @@ class Display_Featured_Image_Genesis_Common { $image_id = self::get_image_id( $term_meta['dfig_image'] ); } // any singular post/page/CPT with either a post_thumbnail larger than medium size OR there is no $item->fallback - elseif ( is_singular() && ( $width > $item->medium || empty( $item->fallback ) ) && ! in_array( get_post_type(), self::use_fallback_image() ) ) { - $image_id = get_post_thumbnail_id( $post->ID ); + elseif ( is_singular() ) { + if ( ( $width > $item->medium /*|| empty( $item->fallback )*/ ) && ! in_array( get_post_type(), self::use_fallback_image() ) ) { + $image_id = get_post_thumbnail_id( $post->ID ); + } + elseif ( ! has_post_thumbnail() ) { + $terms = get_taxonomies(); + $args = array( 'fields' => 'ids', 'orderby' => 'term_group', 'order' => 'DESC' ); + $terms = wp_get_object_terms( get_the_ID(), $terms, $args ); + + foreach ( $terms as $t_id ) { + $term_meta = get_option( "taxonomy_$t_id" ); + $image_id = Display_Featured_Image_Genesis_Common::get_image_id( $term_meta['dfig_image'] ); + } + } } //now actually set the backstretch image source, which includes some metadata