Add blank option in staff details

This commit is contained in:
Brian Miyaji
2014-10-13 17:02:37 +11:00
parent 33ecd1e3a4
commit 42dc93c367
2 changed files with 5 additions and 0 deletions

View File

@@ -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,

View File

@@ -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;