mirror of
https://github.com/10h30/display-featured-image-genesis.git
synced 2026-06-05 15:08:20 +09:00
enable large (in addition to backstretch) images for archives
This commit is contained in:
@@ -75,11 +75,14 @@ class Display_Featured_Image_Genesis_Output {
|
||||
//* otherwise it's a large image.
|
||||
elseif ( $item->width <= $item->large ) {
|
||||
|
||||
remove_action( 'genesis_before_loop', 'genesis_do_cpt_archive_title_description' );
|
||||
add_action( 'genesis_before_loop', 'genesis_do_cpt_archive_title_description', 15 );
|
||||
|
||||
$hook = 'genesis_before_loop';
|
||||
if ( is_singular() && ! is_page_template( 'page_blog.php' ) ) {
|
||||
$hook = apply_filters( 'display_featured_image_genesis_move_large_image', $hook );
|
||||
}
|
||||
add_action( $hook, array( $this, 'do_large_image' ) ); // works for both HTML5 and XHTML
|
||||
add_action( $hook, array( $this, 'do_large_image' ), 12 ); // works for both HTML5 and XHTML
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -429,7 +429,7 @@ class Display_Featured_Image_Genesis_Settings {
|
||||
|
||||
$new_value = esc_url( $new_value );
|
||||
$valid = $this->is_valid_img_ext( $new_value );
|
||||
$large = get_option( 'large_size_w' );
|
||||
$medium = get_option( 'medium_size_w' );
|
||||
$id = Display_Featured_Image_Genesis_Common::get_image_id( $new_value );
|
||||
$metadata = wp_get_attachment_metadata( $id );
|
||||
$width = $metadata['width'];
|
||||
@@ -449,7 +449,7 @@ class Display_Featured_Image_Genesis_Settings {
|
||||
);
|
||||
}
|
||||
//* if file is an image, but is too small, throw it back
|
||||
elseif ( $width <= $large ) {
|
||||
elseif ( $width <= $medium ) {
|
||||
$message = __( 'Sorry, your image is too small.', 'display-featured-image-genesis' );
|
||||
$new_value = false;
|
||||
|
||||
@@ -476,13 +476,13 @@ class Display_Featured_Image_Genesis_Settings {
|
||||
|
||||
$new_value = esc_url( $new_value );
|
||||
$valid = $this->is_valid_img_ext( $new_value );
|
||||
$large = get_option( 'large_size_w' );
|
||||
$medium = get_option( 'medium_size_w' );
|
||||
$id = Display_Featured_Image_Genesis_Common::get_image_id( $new_value );
|
||||
$metadata = wp_get_attachment_metadata( $id );
|
||||
$width = $metadata['width'];
|
||||
|
||||
// ok for field to be empty
|
||||
if ( $new_value && ( ! $valid || $width <= $large ) ) {
|
||||
if ( $new_value && ( ! $valid || $width <= $medium ) ) {
|
||||
$new_value = false;
|
||||
}
|
||||
|
||||
@@ -569,7 +569,8 @@ class Display_Featured_Image_Genesis_Settings {
|
||||
$cpt_help =
|
||||
'<h3>' . __( 'Featured Images for Custom Post Types', 'display-featured-image-genesis' ) . '</h3>' .
|
||||
'<p>' . __( 'Some plugins and/or developers extend the power of WordPress by using Custom Post Types to create special kinds of content.', 'display-featured-image-genesis' ) . '</p>' .
|
||||
'<p>' . __( 'Since your site uses Custom Post Types, you may optionally set a Featured Image for each archive.', 'display-featured-image-genesis' ) . '</p>';
|
||||
'<p>' . __( 'Since your site uses Custom Post Types, you may optionally set a Featured Image for each archive.', 'display-featured-image-genesis' ) . '</p>' .
|
||||
'<p>' . __( 'Featured Images for archives can be smaller than the Default Featured Image, but still need to be larger than your site\'s "medium" image size.', 'display-featured-image-genesis' ) . '</p>';
|
||||
|
||||
|
||||
$screen->add_help_tab( array(
|
||||
|
||||
Reference in New Issue
Block a user