PluginProbe
Property Hive / 1.4.53
Property Hive v1.4.53
2.3.1 2.3.0 2.2.6 2.2.5 2.2.4 2.2.3 2.2.2 1.4.46 1.4.47 1.4.48 1.4.49 1.4.5 1.4.50 1.4.51 1.4.52 1.4.53 1.4.54 1.4.55 1.4.56 1.4.57 1.4.58 1.4.59 1.4.6 1.4.60 1.4.61 All 261 releases
propertyhive / templates / search / orderby.php

orderby.php in Property Hive 1.4.53, at templates/search/orderby.php

74 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Show options for ordering
4 *
5 * @author PropertyHive
6 * @package PropertyHive/Templates
7 * @version 1.0.0
8 */
9
10 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
12 global $propertyhive, $wp_query;
13
14 if ( $wp_query->found_posts < 2 )
15 return;
16 ?>
17 <form class="propertyhive-ordering" method="get">
18 <?php
19
20 if (
21 ( isset($_REQUEST['department']) && $_REQUEST['department'] != 'commercial' ) ||
22 ( !isset($_REQUEST['department']) && get_option( 'propertyhive_primary_department' ) != 'commercial' )
23 )
24 {
25 $results_orderby = apply_filters( 'propertyhive_results_orderby', array(
26 'price-desc' => __( 'Default sorting', 'propertyhive' ),
27 'date' => __( 'Sort by date added', 'propertyhive' ),
28 'price-asc' => __( 'Sort by price: low to high', 'propertyhive' ),
29 'price-desc' => __( 'Sort by price: high to low', 'propertyhive' ),
30 ) );
31 }
32 else
33 {
34 $results_orderby = apply_filters( 'propertyhive_results_orderby', array(
35 'floor_area-desc' => __( 'Default sorting', 'propertyhive' ),
36 'date' => __( 'Sort by date added', 'propertyhive' ),
37 'floor_area-asc' => __( 'Sort by floor area: low to high', 'propertyhive' ),
38 'floor_area-desc' => __( 'Sort by floor area: high to low', 'propertyhive' ),
39 'price-asc' => __( 'Sort by price: low to high', 'propertyhive' ),
40 'price-desc' => __( 'Sort by price: high to low', 'propertyhive' ),
41 ) );
42 }
43
44 if ( !empty($results_orderby) )
45 {
46 ?>
47 <select name="orderby" class="orderby">
48 <?php
49 foreach ( $results_orderby as $id => $name )
50 {
51 echo '<option value="' . esc_attr( $id ) . '" ' . selected( $orderby, $id, false ) . '>' . esc_attr( $name ) . '</option>';
52 }
53 ?>
54 </select>
55 <?php
56 }
57
58 // Keep query string vars intact
59 foreach ( $_GET as $key => $val ) {
60 if ( 'orderby' === $key || 'submit' === $key )
61 continue;
62
63 if ( is_array( $val ) ) {
64 foreach( $val as $innerVal ) {
65 echo '<input type="hidden" name="' . esc_attr( $key ) . '[]" value="' . esc_attr( $innerVal ) . '" />';
66 }
67
68 } else {
69 echo '<input type="hidden" name="' . esc_attr( $key ) . '" value="' . esc_attr( $val ) . '" />';
70 }
71 }
72 ?>
73 </form>
74