Add blank option in staff details
This commit is contained in:
@@ -59,6 +59,7 @@ class SP_Meta_Box_Staff_Details {
|
||||
'name' => 'sp_role',
|
||||
'selected' => $role,
|
||||
'values' => 'term_id',
|
||||
'show_option_blank' => true,
|
||||
'placeholder' => sprintf( __( 'Select %s', 'sportspress' ), __( 'Role', 'sportspress' ) ),
|
||||
'class' => 'widefat',
|
||||
'chosen' => true,
|
||||
|
||||
@@ -451,6 +451,7 @@ if ( !function_exists( 'sp_dropdown_dates' ) ) {
|
||||
if ( !function_exists( 'sp_dropdown_taxonomies' ) ) {
|
||||
function sp_dropdown_taxonomies( $args = array() ) {
|
||||
$defaults = array(
|
||||
'show_option_blank' => false,
|
||||
'show_option_all' => false,
|
||||
'show_option_none' => false,
|
||||
'taxonomy' => null,
|
||||
@@ -495,6 +496,9 @@ if ( !function_exists( 'sp_dropdown_taxonomies' ) ) {
|
||||
printf( '<select name="%s" class="postform %s" %s>', $name, $class . ( $chosen ? ' chosen-select' . ( is_rtl() ? ' chosen-rtl' : '' ) : '' ), ( $placeholder != null ? 'data-placeholder="' . $placeholder . '" ' : '' ) . $property );
|
||||
|
||||
if ( strpos( $property, 'multiple' ) === false ):
|
||||
if ( $args['show_option_blank'] ):
|
||||
echo '<option></option>';
|
||||
endif;
|
||||
if ( $args['show_option_all'] ):
|
||||
printf( '<option value="0">%s</option>', $args['show_option_all'] );
|
||||
endif;
|
||||
|
||||
Reference in New Issue
Block a user