PluginProbe
Property Hive / 2.2.3
Property Hive v2.2.3
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 2.2.3, at templates/search/orderby.php

71 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;
13
14 ?>
15 <form class="propertyhive-ordering" method="get">
16 <?php
17 if (
18 ( !in_array( $department, array('', 'commercial') ) && ph_get_custom_department_based_on($department) != 'commercial' ) ||
19 ( $department == '' && get_option( 'propertyhive_primary_department' ) != 'commercial' && ph_get_custom_department_based_on(get_option( 'propertyhive_primary_department' )) != 'commercial' )
20 )
21 {
22 $results_orderby = apply_filters( 'propertyhive_results_orderby', array(
23 'price-desc' => __( 'Default sorting', 'propertyhive' ),
24 'date' => __( 'Sort by date added', 'propertyhive' ),
25 'price-asc' => __( 'Sort by price: low to high', 'propertyhive' ),
26 'price-desc' => __( 'Sort by price: high to low', 'propertyhive' ),
27 ) );
28 }
29 else
30 {
31 $results_orderby = apply_filters( 'propertyhive_results_orderby', array(
32 'floor_area-desc' => __( 'Default sorting', 'propertyhive' ),
33 'date' => __( 'Sort by date added', 'propertyhive' ),
34 'floor_area-asc' => __( 'Sort by floor area: low to high', 'propertyhive' ),
35 'floor_area-desc' => __( 'Sort by floor area: high to low', 'propertyhive' ),
36 'price-asc' => __( 'Sort by price: low to high', 'propertyhive' ),
37 'price-desc' => __( 'Sort by price: high to low', 'propertyhive' ),
38 ) );
39 }
40
41 if ( !empty($results_orderby) )
42 {
43 ?>
44 <select name="orderby" class="orderby">
45 <?php
46 foreach ( $results_orderby as $id => $name )
47 {
48 echo '<option value="' . esc_attr( $id ) . '" ' . selected( $orderby, $id, false ) . '>' . esc_attr( $name ) . '</option>';
49 }
50 ?>
51 </select>
52 <?php
53 }
54
55 // Keep query string vars intact
56 foreach ( $_GET as $key => $val ) {
57 if ( 'orderby' === $key || 'submit' === $key )
58 continue;
59
60 if ( is_array( $val ) ) {
61 foreach( $val as $innerVal ) {
62 echo '<input type="hidden" name="' . esc_attr( $key ) . '[]" value="' . esc_attr( $innerVal ) . '" />';
63 }
64
65 } else {
66 echo '<input type="hidden" name="' . esc_attr( $key ) . '" value="' . esc_attr( $val ) . '" />';
67 }
68 }
69 ?>
70 </form>
71