| 1 |
<?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?> |
| 2 |
|
| 3 |
<?php |
| 4 |
$_GET['orderby'] = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : false; |
| 5 |
$_GET['order'] = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : false; |
| 6 |
?> |
| 7 |
|
| 8 |
<div class="listings-sort"> |
| 9 |
|
| 10 |
<select name="listings-sort"> |
| 11 |
|
| 12 |
<option value=""><?php echo esc_html( $args['labels']['orderby'] ); ?></option> |
| 13 |
|
| 14 |
<option<?php if ( $_GET['orderby'] == 'date' && $_GET['order'] == 'asc' ) echo ' selected="selected"'; ?> value="<?php echo esc_url( add_query_arg( array( 'orderby' => 'date', 'order' => 'asc' ) ) ); ?>"><?php echo esc_html( $args['labels']['date'] ); ?> (<?php echo esc_html( $args['labels']['asc'] ); ?>)</option> |
| 15 |
|
| 16 |
<option<?php if ( $_GET['orderby'] == 'date' && $_GET['order'] == 'desc' ) echo ' selected="selected"'; ?> value="<?php echo esc_url( add_query_arg( array( 'orderby' => 'date', 'order' => 'desc' ) ) ); ?>"><?php echo esc_html( $args['labels']['date'] ); ?> (<?php echo esc_html( $args['labels']['desc'] ); ?>)</option> |
| 17 |
|
| 18 |
<option<?php if ( $_GET['orderby'] == 'price' && $_GET['order'] == 'asc' ) echo ' selected="selected"'; ?> value="<?php echo esc_url( add_query_arg( array( 'orderby' => 'price', 'order' => 'asc' ) ) ); ?>"><?php echo esc_html( $args['labels']['price'] ); ?> (<?php echo esc_html( $args['labels']['asc'] ); ?>)</option> |
| 19 |
|
| 20 |
<option<?php if ( $_GET['orderby'] == 'price' && $_GET['order'] == 'desc' ) echo ' selected="selected"'; ?> value="<?php echo esc_url( add_query_arg( array( 'orderby' => 'price', 'order' => 'desc' ) ) ); ?>"><?php echo esc_html( $args['labels']['price'] ); ?> (<?php echo esc_html( $args['labels']['desc'] ); ?>)</option> |
| 21 |
|
| 22 |
<option<?php if ( $_GET['orderby'] == 'title' && $_GET['order'] == 'asc' ) echo ' selected="selected"'; ?> value="<?php echo esc_url( add_query_arg( array( 'orderby' => 'title', 'order' => 'asc' ) ) ); ?>"><?php echo esc_html( $args['labels']['title'] ); ?> (<?php echo esc_html( $args['labels']['asc'] ); ?>)</option> |
| 23 |
|
| 24 |
<option<?php if ( $_GET['orderby'] == 'title' && $_GET['order'] == 'desc' ) echo ' selected="selected"'; ?> value="<?php echo esc_url( add_query_arg( array( 'orderby' => 'title', 'order' => 'desc' ) ) ); ?>"><?php echo esc_html( $args['labels']['title'] ); ?> (<?php echo esc_html( $args['labels']['desc'] ); ?>)</option> |
| 25 |
|
| 26 |
</select> |
| 27 |
|
| 28 |
</div><!-- .listings-sort --> |