Add setting to always use default image

This commit is contained in:
Robin Cornett
2016-07-02 14:02:54 -04:00
parent 518937a3ab
commit 72a50ea505
4 changed files with 15 additions and 1 deletions
@@ -80,7 +80,7 @@ class Display_Featured_Image_Genesis_Common {
* @uses is_in_array()
*/
$image_id = $fallback_id;
if ( self::is_in_array( 'use_default' ) ) {
if ( self::is_in_array( 'use_default' ) || $setting['always_default'] ) {
return (int) $image_id;
}
}
@@ -102,6 +102,11 @@ class Display_Featured_Image_Genesis_Customizer extends Display_Featured_Image_G
protected function checkbox_fields() {
return array(
array(
'setting' => 'always_default',
'label' => __( 'Always Use Default', 'display-featured-image-genesis' ),
'description' => __( 'Always use the default image, even if a featured image is set.', 'display-featured-image-genesis' ),
),
array(
'setting' => 'exclude_front',
'label' => __( 'Skip Front Page', 'display-featured-image-genesis' ),
@@ -144,6 +144,7 @@ class Display_Featured_Image_Genesis_HelpTabs extends Display_Featured_Image_Gen
__( 'Supported file types are: jpg, jpeg, png, and gif. The image must be at least %1$s pixels wide.', 'display-featured-image-genesis' ),
absint( $large + 1 )
) . '</p>';
$help .= '<p>' . __( 'If you choose "Always Use Default", your default image will be used site wide, no matter what content types/posts/etc. have featured images set.', 'display-featured-image-genesis' ) . '</p>';
return $help;
}
@@ -141,6 +141,7 @@ class Display_Featured_Image_Genesis_Settings extends Display_Featured_Image_Gen
'skip' => array(),
'fallback' => array(),
'max_height' => '',
'always_default' => 0,
) );
}
@@ -208,6 +209,13 @@ class Display_Featured_Image_Genesis_Settings extends Display_Featured_Image_Gen
'callback' => 'set_default_image',
'section' => 'main',
),
array(
'id' => 'always_default',
'title' => __( 'Always Use Default', 'display-featured-image-genesis' ),
'callback' => 'do_checkbox',
'section' => 'main',
'args' => array( 'setting' => 'always_default', 'label' => __( 'Always use the default image, even if a featured image is set.', 'display-featured-image-genesis' ) ),
),
array(
'id' => 'exclude_front',
'title' => __( 'Skip Front Page', 'display-featured-image-genesis' ),