mirror of
https://github.com/10h30/display-featured-image-genesis.git
synced 2026-07-16 21:13:18 +09:00
Change large/fallback CPT settings output
This commit is contained in:
@@ -373,7 +373,7 @@ class Display_Featured_Image_Genesis_Common {
|
||||
* whether get_post_type array should use large image instead of backstretch.
|
||||
* @uses is_in_array()
|
||||
*/
|
||||
if ( self::is_in_array( 'use_large_image' ) || $setting['large'][ $post_type ] ) {
|
||||
if ( self::is_in_array( 'use_large_image' ) || ( isset( $setting['large'][ $post_type ] ) && $setting['large'][ $post_type ] ) ) {
|
||||
return 'large';
|
||||
}
|
||||
|
||||
|
||||
@@ -155,6 +155,7 @@ class Display_Featured_Image_Genesis_Helper extends DisplayFeaturedImageGenesisG
|
||||
);
|
||||
$this->do_checkbox( $type_args );
|
||||
}
|
||||
$this->do_description( $args );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -194,13 +194,29 @@ class Display_Featured_Image_Genesis_Settings_Define extends Display_Featured_Im
|
||||
'section' => 'cpt',
|
||||
'options' => $this->get_post_types(),
|
||||
),
|
||||
array(
|
||||
'id' => 'fallback',
|
||||
'title' => __( 'Prefer Fallback Images', 'display-featured-image-genesis' ),
|
||||
'callback' => 'do_checkbox_array',
|
||||
'section' => 'cpt',
|
||||
'options' => $this->get_post_types(),
|
||||
'description' => __( 'Select content types which should always use a fallback image, even if a featured image has been set.', 'display-featured-image-genesis' ),
|
||||
),
|
||||
array(
|
||||
'id' => 'large',
|
||||
'title' => __( 'Force Large Images', 'display-featured-image-genesis' ),
|
||||
'callback' => 'do_checkbox_array',
|
||||
'section' => 'cpt',
|
||||
'options' => $this->get_post_types(),
|
||||
'description' => __( 'Select content types which should always prefer to use the large image size instead of the backstretch, even if a backstretch size image is available.', 'display-featured-image-genesis' ),
|
||||
),
|
||||
);
|
||||
|
||||
$custom_pages = array(
|
||||
$custom_pages = array(
|
||||
'search' => __( 'Search Results', 'display-featured-image-genesis' ),
|
||||
'fourohfour' => __( '404 Page', 'display-featured-image-genesis' ),
|
||||
);
|
||||
$post_types = array_merge( $custom_pages, $this->get_post_types() );
|
||||
$post_types = array_merge( $custom_pages, $this->get_post_types() );
|
||||
foreach ( $post_types as $post_type => $label ) {
|
||||
$fields[] = array(
|
||||
'id' => esc_attr( $post_type ),
|
||||
|
||||
@@ -239,7 +239,6 @@ class Display_Featured_Image_Genesis_Settings extends Display_Featured_Image_Gen
|
||||
public function set_cpt_image( $args ) {
|
||||
|
||||
$this->do_image_buttons( $args );
|
||||
$this->do_cpt_checkboxes( $args );
|
||||
|
||||
if ( empty( $id ) || in_array( $args['id'], array( 'search', 'fourohfour', 'post' ), true ) ) {
|
||||
return;
|
||||
@@ -270,38 +269,6 @@ class Display_Featured_Image_Genesis_Settings extends Display_Featured_Image_Gen
|
||||
$this->render_buttons( $id, $name );
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the CPT checkboxes.
|
||||
*
|
||||
* @param $args
|
||||
*/
|
||||
protected function do_cpt_checkboxes( $args ) {
|
||||
if ( in_array( $args['id'], array( 'search', 'fourohfour' ), true ) ) {
|
||||
return;
|
||||
}
|
||||
$checkbox_args = array(
|
||||
array(
|
||||
'id' => "fallback][{$args['id']}",
|
||||
/* translators: placeholder is the post type label. */
|
||||
'label' => sprintf( __( 'Always use a fallback image for %s.', 'display-featured-image-genesis' ), esc_attr( $args['title'] ) ),
|
||||
'setting_name' => 'fallback',
|
||||
'name' => $args['id'],
|
||||
),
|
||||
array(
|
||||
'id' => "large][{$args['id']}",
|
||||
/* translators: placeholder is the post type label. */
|
||||
'label' => sprintf( __( 'Always use a large/not backstretch image for %s.', 'display-featured-image-genesis' ), esc_attr( $args['title'] ) ),
|
||||
'setting_name' => 'large',
|
||||
'name' => $args['id'],
|
||||
),
|
||||
);
|
||||
foreach ( $checkbox_args as $checkbox ) {
|
||||
echo '<p>';
|
||||
$this->do_checkbox( $checkbox );
|
||||
echo '</p>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the CPT description.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user