Fix errors when no featured image is set

This commit is contained in:
Robin Cornett
2020-07-27 17:37:13 -04:00
parent 6a791798f9
commit bfb57f2a6f
2 changed files with 18 additions and 14 deletions
@@ -59,7 +59,7 @@ class Display_Featured_Image_Genesis_Common {
// set a content variable so backstretch doesn't show if full size image exists in post.
$item->content = false;
// declare this last so that $item->backstretch is set.
if ( ! is_admin() && is_singular() ) {
if ( ! is_admin() && is_singular() && ! empty( $item->backstretch[0] ) ) {
$post_content = get_post_field( 'post_content' );
$item->content = strpos( $post_content, 'src="' . $item->backstretch[0] );
}
@@ -350,7 +350,8 @@ class Display_Featured_Image_Genesis_Common {
FROM {$wpdb->posts} wposts, {$wpdb->postmeta} wpostmeta
WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = '_wp_attached_file' AND wpostmeta.meta_value IN ( %s, %s ) AND wposts.post_type = 'attachment'
",
$url_stripped, $attachment_url
$url_stripped,
$attachment_url
);
$result = $wpdb->get_col( $query_sql );