mirror of
https://github.com/10h30/display-featured-image-genesis.git
synced 2026-07-11 18:46:03 +09:00
Change post type getter
This commit is contained in:
@@ -110,8 +110,8 @@ class Display_Featured_Image_Genesis_Common {
|
||||
}
|
||||
|
||||
// if a post type image exists, it takes priority over the fallback. check that next.
|
||||
$post_type = get_post_type();
|
||||
if ( isset( $setting['post_type'][ $post_type ] ) && $setting['post_type'][ $post_type ] ) {
|
||||
$post_type = self::get_post_type();
|
||||
if ( ! empty( $setting['post_type'][ $post_type ] ) ) {
|
||||
/**
|
||||
* Creates display_featured_image_genesis_use_post_type_image filter to check
|
||||
* whether get_post_type array should use the post type image.
|
||||
@@ -163,6 +163,20 @@ class Display_Featured_Image_Genesis_Common {
|
||||
return $image_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current post type.
|
||||
* @return false|object|string
|
||||
*/
|
||||
private static function get_post_type() {
|
||||
$post_type = get_post_type();
|
||||
if ( ! is_post_type_archive() ) {
|
||||
return $post_type;
|
||||
}
|
||||
$post_type = get_queried_object();
|
||||
|
||||
return $post_type->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the featured image for the singular post
|
||||
* @param $image_id int|string
|
||||
|
||||
Reference in New Issue
Block a user