Replace count with empty check

This commit is contained in:
Jon Surrell 2017-01-05 16:33:58 +01:00
parent e6bcc1aeb6
commit d38e22329f
1 changed files with 15 additions and 19 deletions

View File

@ -200,26 +200,22 @@ class WC_Admin_Log_Table_List extends WP_List_Table {
ORDER BY source ASC
" );
$source_count = count( $sources );
if ( ! $source_count ) {
return;
if ( ! empty( $sources ) ) {
$selected_source = isset( $_REQUEST['source'] ) ? $_REQUEST['source'] : '';
?>
<label for="filter-by-source" class="screen-reader-text"><?php _e( 'Filter by source', 'woocommerce' ); ?></label>
<select name="source" id="filter-by-source">
<option<?php selected( $selected_source, '' ); ?> value=""><?php _e( 'All sources', 'woocommerce' ); ?></option>
<?php foreach ( $sources as $s ) {
printf( '<option%1$s value="%2$s">%3$s</option>',
selected( $selected_source, $s, false ),
esc_attr( $s ),
esc_html( $s )
);
} ?>
</select>
<?php
}
$selected_source = isset( $_REQUEST['source'] ) ? $_REQUEST['source'] : '';
?>
<label for="filter-by-source" class="screen-reader-text"><?php _e( 'Filter by source', 'woocommerce' ); ?></label>
<select name="source" id="filter-by-source">
<option<?php selected( $selected_source, '' ); ?> value=""><?php _e( 'All sources', 'woocommerce' ); ?></option>
<?php foreach ( $sources as $s ) {
printf( '<option%1$s value="%2$s">%3$s</option>',
selected( $selected_source, $s, false ),
esc_attr( $s ),
esc_html( $s )
);
} ?>
</select>
<?php
}
/**