mirror of
https://github.com/10h30/display-featured-image-genesis.git
synced 2026-07-18 14:03:20 +09:00
Fix errors when no featured image is set
This commit is contained in:
@@ -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 );
|
||||
|
||||
@@ -56,7 +56,7 @@ class Display_Featured_Image_Genesis_Output {
|
||||
|
||||
$large = $this->get_minimum_backstretch_width();
|
||||
$item = $this->get_item();
|
||||
$width = absint( $item->backstretch[1] );
|
||||
$width = empty( $item->backstretch[1] ) ? 0 : (int) $item->backstretch[1];
|
||||
/**
|
||||
* Creates display_featured_image_genesis_force_backstretch filter to check
|
||||
* whether get_post_type array should force the backstretch effect for this post type.
|
||||
@@ -295,7 +295,7 @@ class Display_Featured_Image_Genesis_Output {
|
||||
$can_do = true;
|
||||
$item = $this->get_item();
|
||||
$medium = (int) apply_filters( 'displayfeaturedimagegenesis_set_medium_width', get_option( 'medium_size_w' ) );
|
||||
$width = (int) $item->backstretch[1];
|
||||
$width = empty( $item->backstretch[1] ) ? 0 : (int) $item->backstretch[1];
|
||||
|
||||
// check if they have enabled display on subsequent pages
|
||||
$is_paged = $this->get_setting( 'is_paged' );
|
||||
@@ -431,16 +431,19 @@ class Display_Featured_Image_Genesis_Output {
|
||||
}
|
||||
}
|
||||
|
||||
return apply_filters( 'displayfeaturedimagegenesis_hooks', array(
|
||||
'backstretch' => array(
|
||||
'hook' => apply_filters( 'display_featured_image_move_backstretch_image', $setting['backstretch_hook'] ),
|
||||
'priority' => apply_filters( 'display_featured_image_move_backstretch_image_priority', $setting['backstretch_priority'] ),
|
||||
),
|
||||
'large' => array(
|
||||
'hook' => $large_hook,
|
||||
'priority' => apply_filters( 'display_featured_image_genesis_move_large_image_priority', $setting['large_priority'] ),
|
||||
),
|
||||
) );
|
||||
return apply_filters(
|
||||
'displayfeaturedimagegenesis_hooks',
|
||||
array(
|
||||
'backstretch' => array(
|
||||
'hook' => apply_filters( 'display_featured_image_move_backstretch_image', $setting['backstretch_hook'] ),
|
||||
'priority' => apply_filters( 'display_featured_image_move_backstretch_image_priority', $setting['backstretch_priority'] ),
|
||||
),
|
||||
'large' => array(
|
||||
'hook' => $large_hook,
|
||||
'priority' => apply_filters( 'display_featured_image_genesis_move_large_image_priority', $setting['large_priority'] ),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user