| 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; ?> |