ap_get_category_filter( string|boolean $search = false )
Description #
Return category for sorting dropdown.
Parameters #
- $searchstring | boolean (Optional) Search value. Default value: false
Source #
File: includes/taxo.php
function ap_get_category_filter( $search = false ) { $args = array( 'taxonomy' => 'question_category', 'hierarchical' => true, 'hide_if_empty' => true, 'number' => 10, ); if ( false !== $search ) { $args['search'] = $search; } $terms = get_terms( $args ); $selected = ap_get_current_list_filters( 'category' ); if ( ! $terms ) { return false; } $items = array(); foreach ( (array) $terms as $t ) { $item = array( 'key' => 'category', 'value' => (string) $t->term_id, 'label' => $t->name, ); // Check if active. if ( $selected && in_array( $t->term_id, $selected, true ) ) { $item['active'] = true; } $items[] = $item; } return $items; }
Expand full source code Collapse full source code View on GitHub: includes/taxo.php:183
Add your comment