Add fallback setting for custom content types

This commit is contained in:
Robin Cornett
2016-03-31 11:36:55 -04:00
parent 963a170e4c
commit 1b4e5e8bf8
3 changed files with 40 additions and 9 deletions
@@ -324,6 +324,15 @@ class Display_Featured_Image_Genesis_Settings extends Display_Featured_Image_Gen
$this->setting['post_type'][ $post_type ] = $id = '';
}
if ( is_object( $args['post_type'] ) ) {
$fallback_args = array(
'setting' => "fallback][{$post_type}",
'label' => sprintf( __( 'Always use a fallback image for %s.', 'display-featured-image-genesis' ), esc_attr( $args['post_type']->label ) ),
'setting_name' => 'fallback',
'name' => $post_type,
);
$this->do_checkbox( $fallback_args );
}
$id = $this->setting['post_type'][ $post_type ];
$name = 'displayfeaturedimagegenesis[post_type][' . esc_attr( $post_type ) . ']';
if ( $id ) {
@@ -393,6 +402,7 @@ class Display_Featured_Image_Genesis_Settings extends Display_Featured_Image_Gen
// sanitize
$new_value['post_type'][ $object->name ] = $this->validate_image( $new_value['post_type'][ $object->name ], $old_value, $label, $size_to_check );
$new_value['fallback'][ $object->name ] = $this->one_zero( $new_value['fallback'][ $object->name ] );
}
return $new_value;