ap_get_tag_filter( string|false $search = false )
Description #
Return category for sorting dropdown.
Parameters #
- $searchstring | false (Optional) Search query. Default value: false
Source #
File: includes/taxo.php
function ap_get_tag_filter( $search = false ) {
$args = array(
'taxonomy' => 'question_tag',
'hierarchical' => true,
'hide_if_empty' => true,
'number' => 10,
);
if ( false !== $search ) {
$args['search'] = $search;
}
$terms = get_terms( $args );
$selected = ap_get_current_list_filters( 'qtag' );
if ( ! $terms ) {
return false;
}
$items = array();
foreach ( (array) $terms as $t ) {
$item = array(
'key' => 'qtag',
'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:460
Add your comment