PluginProbe
Filter Everything — WordPress & WooCommerce Filters / trunk
Filter Everything — WordPress & WooCommerce Filters vtrunk
1.9.6 1.9.5 1.9.4 1.9.3 1.9.2.2 1.9.2.1 trunk 1.2.1 1.2.3 1.2.4 1.2.5 1.3.0 1.3.1 1.3.2 1.4.1 1.4.4 1.4.5 1.4.8 1.4.9 1.5.0 1.5.1 1.6.0 1.6.1 1.6.2 1.6.3 All 51 releases
filter-everything / views / frontend / orderby.php

orderby.php in Filter Everything — WordPress & WooCommerce Filters trunk, at views/frontend/orderby.php

45 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The Template for displaying ordering dropdown.
4 *
5 * This template can be overridden by copying it to yourtheme/filters/orderby.php.
6 *
7 * @param string $action Form action URL
8 * @param string $selected_orderby Currently selected value.
9 * @param array $titles Possible titles.
10 * @param array $orderbies Possible orderbies.
11 * @param array $orders Possible orders.
12 * @param array $meta_keys Possible meta keys.
13 *
14 * @see https://filtereverything.pro/resources/templates-overriding/
15 * @since 1.2.6
16 */
17
18 if ( ! defined( 'ABSPATH' ) ) {
19 exit;
20 }
21 // @todo security and XSS esc_attr, sanitize attr
22 // @todo mark selected value
23 ?>
24 <?php if( isset( $orderbies ) && ! empty( $orderbies ) ) : ?>
25 <form action="<?php echo esc_url( $action ); ?>" class="wpc-sorting-form" method="GET">
26 <?php
27 // 3rd party $_GET parameters
28 flrt_query_string_form_fields(
29 flrt_get_query_string_parameters(),
30 ['ordr', 'orderby', 'product_orderby'] // Ignore these params
31 );
32 ?>
33
34 <select name="ordr" class="wpc-orderby-select" aria-label="wpc-orderby-select">
35 <?php
36 foreach( $orderbies as $i => $order_by_value ) :
37 $title = isset( $titles[$i] ) ? $titles[$i] : '';
38 $option_value = flrt_sorting_option_value( $order_by_value, $meta_keys, $orders, $i );
39 ?>
40 <option value="<?php echo esc_attr( $option_value ); ?>" <?php selected( $selected_orderby, $option_value ); ?>><?php echo esc_html( $title ); ?></option>
41 <?php endforeach; ?>
42 </select>
43 </form>
44 <div class="wpc-after-sorting-form"></div>
45 <?php endif; ?>