Inventory_Presser_Order_By_Widget::get_post_meta_keys_and_labels( array $instance )
Produces an associative array where the post meta keys are the keys and the values are human-readable labels.
On This Page
Parameters Parameters
- $instance
-
(array) (Required) The widget options.
Return Return
(array)
Source Source
File: includes/widget/class-widget-order-by.php
protected function get_post_meta_keys_and_labels( $instance ) { $arr = array(); foreach ( INVP::keys() as $key ) { $key = apply_filters( 'invp_prefix_meta_key', $key ); // if we have a saved label, use that. otherwise, create a label. $arr[ $key ] = ( isset( $instance[ 'label-' . $key ] ) ? $instance[ 'label-' . $key ] : $this->prettify_meta_key( $key ) ); } /** * Some fields do not make sense to order by, such as interior color & VIN */ $ignored_keys = array( apply_filters( 'invp_prefix_meta_key', 'body_style' ), apply_filters( 'invp_prefix_meta_key', 'car_id' ), apply_filters( 'invp_prefix_meta_key', 'color' ), apply_filters( 'invp_prefix_meta_key', 'dealer_id' ), apply_filters( 'invp_prefix_meta_key', 'edmunds_style_id' ), apply_filters( 'invp_prefix_meta_key', 'engine' ), apply_filters( 'invp_prefix_meta_key', 'featured' ), apply_filters( 'invp_prefix_meta_key', 'interior_color' ), apply_filters( 'invp_prefix_meta_key', 'leads_id' ), apply_filters( 'invp_prefix_meta_key', 'options_array' ), apply_filters( 'invp_prefix_meta_key', 'prices' ), apply_filters( 'invp_prefix_meta_key', 'trim' ), apply_filters( 'invp_prefix_meta_key', 'vin' ), ); foreach ( apply_filters( 'invp_sort_by_widget_ignored_fields', $ignored_keys ) as $ignored_key ) { unset( $arr[ $ignored_key ] ); } return $arr; }
Expand full source codeCollapse full source codeView on Github