function orbis_deal_get_status_label($status) { $statuses = orbis_deal_get_statuses(); $label = null; if (isset($statuses[$status])) { $label = $statuses[$status]; } return $label; }
<th scope="row"> <label for="orbis_deal_price"><?php _e('Price', 'orbis_deals'); ?> </label> </th> <td> <input id="orbis_deal_price" name="_orbis_deal_price" value="<?php echo empty($price) ? '' : esc_attr(number_format($price, 2, ',', '.')); ?> " type="text" class="regular-text" /> </td> </tr> <tr valign="top"> <th scope="row"> <label for="orbis_deal_status"><?php _e('Status', 'orbis_deals'); ?> </label> </th> <td> <select id="orbis_deal_status" name="_orbis_deal_status"> <?php foreach (orbis_deal_get_statuses() as $status_key => $status_value) { printf('<option value="%s" %s>%s</option>', esc_attr($status_key), selected($status_key, $status, false), esc_html($status_value)); } ?> </select> </td> </tr> </table>
<div class="pull-right"> <select name="orbis_deal_status" class="form-control"> <?php $statuses = orbis_deal_get_statuses(); array_unshift($statuses, __('— Select Status —', 'orbis')); $status = filter_input(INPUT_GET, 'orbis_deal_status', FILTER_SANITIZE_STRING); foreach ($statuses as $key => $label) { printf('<option value="%s" %s>%s</option>', esc_attr($key), selected($key, $status, false), esc_html($label)); } ?> </select> <button class="btn btn-default" type="submit"><?php _e('Filter', 'orbis'); ?> </button> </div>