Set empty options for CPT/author blocks

This commit is contained in:
Robin Cornett
2019-06-26 08:58:16 -04:00
parent 031c05c47b
commit f7fd26c803
4 changed files with 15 additions and 3 deletions
@@ -45,8 +45,11 @@ class DisplayFeaturedImageGenesisWidgetsBlocksOutput {
public function render_author( $atts ) {
$block_id = 'author';
$atts = $this->update_attributes( $atts, $block_id );
$classes = $this->get_block_classes( $atts, $block_id );
include_once plugin_dir_path( dirname( __FILE__ ) ) . 'output/class-displayfeaturedimagegenesis-output-author.php';
if ( empty( $atts['user'] ) ) {
return '';
}
$classes = $this->get_block_classes( $atts, $block_id );
ob_start();
echo '<div class="' . esc_attr( $classes ) . '">';
@@ -40,7 +40,10 @@ class DisplayFeaturedImageGenesisWidgetsForm {
$output = 'objects';
$post_types = get_post_types( $args, $output );
$options['post'] = __( 'Posts', 'display-featured-image-genesis' );
$options = array(
'' => '--',
'post' => __( 'Posts', 'display-featured-image-genesis' ),
);
foreach ( $post_types as $post_type ) {
$options[ $post_type->name ] = $post_type->label;
}
+3 -1
View File
@@ -5,7 +5,9 @@ $users = get_users(
'who' => 'authors',
)
);
$options = array();
$options = array(
'' => '--',
);
foreach ( $users as $user ) {
$options[ $user->ID ] = $user->data->display_name;
}
+4
View File
@@ -18,6 +18,8 @@ return array(
__( 'Author', 'display-featured-image-genesis' ),
__( 'Featured Image', 'display-featured-image-genesis' ),
),
'placeholder' => __( 'Please select an author.', 'display-featured-image-genesis' ),
'required' => 'user',
),
'cpt' => array(
'title' => __( 'Display Featured Post Type Archive Image', 'display-featured-image-genesis' ),
@@ -26,5 +28,7 @@ return array(
__( 'Post Type', 'display-featured-image-genesis' ),
__( 'Featured Image', 'display-featured-image-genesis' ),
),
'placeholder' => __( 'Please select a post type.', 'display-featured-image-genesis' ),
'required' => 'post_type',
),
);