ap_list_filters( string $current_url = '' )
Description #
Output list filters form.
Parameters #
- $current_urlstring (Optional) Current Url. Default value: ''
Source #
File: includes/theme.php
function ap_list_filters( $current_url = '' ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found $filters = ap_get_list_filters(); echo '<form id="ap-filters" class="ap-filters clearfix" method="GET">'; foreach ( (array) $filters as $key => $filter ) { $active = ''; $current_order_by = ap_get_current_list_filters( 'order_by' ); if ( ! empty( $current_order_by ) ) { $active_arr = ap_search_array( ap_get_questions_orderby(), 'value', $current_order_by ); if ( ! empty( $active_arr ) ) { $active = ': <span class="ap-filter-active">' . $active_arr[0]['label'] . '</span>'; } } $active = apply_filters( 'ap_list_filter_active_' . $key, $active, $filter ); $args = wp_json_encode( array( '__nonce' => wp_create_nonce( 'filter_' . $key ), 'filter' => $key, ) ); echo '<div class="ap-dropdown ap-filter filter-' . esc_attr( $key ) . '">'; echo '<a class="ap-dropdown-toggle ap-filter-toggle" href="#" ap-filter apquery="' . esc_js( $args ) . '">' . esc_attr( $filter['title'] ) . wp_kses_post( $active ) . '</a>'; echo '</div>'; } echo '<button id="ap-filter-reset" type="submit" name="reset-filter" title="' . esc_attr__( 'Reset sorting and filter', 'anspress-question-answer' ) . '"><i class="apicon-x"></i><span>' . esc_attr__( 'Clear Filter', 'anspress-question-answer' ) . '</span></button>'; foreach ( (array) ap_get_current_list_filters() as $key => $value ) { if ( ! is_array( $value ) ) { echo '<input type="hidden" value="' . esc_attr( $value ) . '" name="' . esc_attr( $key ) . '" />'; } else { foreach ( (array) $value as $v ) { echo '<input type="hidden" value="' . esc_attr( $v ) . '" name="' . esc_attr( $key ) . '[]" />'; } } } echo '</form>'; }
Expand full source code Collapse full source code View on GitHub: includes/theme.php:760
Add your comment