mirror of
https://github.com/10h30/display-featured-image-genesis.git
synced 2026-07-11 18:46:03 +09:00
Set empty options for CPT/author blocks
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,9 @@ $users = get_users(
|
||||
'who' => 'authors',
|
||||
)
|
||||
);
|
||||
$options = array();
|
||||
$options = array(
|
||||
'' => '--',
|
||||
);
|
||||
foreach ( $users as $user ) {
|
||||
$options[ $user->ID ] = $user->data->display_name;
|
||||
}
|
||||
|
||||
@@ -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',
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user