diff options
| Commit | d02132aaf2effe0839c7ec62a5e810e72bf3a87d (patch) | |
|---|---|---|
| Author | 2020-07-14 17:18:53 +0300 | |
| Committer | 2020-07-14 17:18:53 +0300 | |
| Files | f04d7c40402673b76cba64640b1481d50b872f90 | |
| tues-interns-2020-feature-cars-search.tar tues-interns-2020-feature-cars-search.tar.gz tues-interns-2020-feature-cars-search.zip | ||
| Parent | e1db4dfbb62e4d411a7c2fa3205b5566f4c9514a (diff) | |
Updated search to work with new field and taxonomy naming. feature-cars-search
1 files changed, 12 insertions, 12 deletions
| -rw-r--r-- | wp-content/plugins/dx-vehicles/search-class.php | 24 |
diff --git a/wp-content/plugins/dx-vehicles/search-class.php b/wp-content/plugins/dx-vehicles/search-class.php index 620f0a1..43316e5 100644 --- a/wp-content/plugins/dx-vehicles/search-class.php +++ b/wp-content/plugins/dx-vehicles/search-class.php @@ -7,28 +7,28 @@ class Search { } static $tax_vars = array( // tax_name (what is in the request) => tax_key (what is in the database, only hierarchical taxonomies are different from tax_name ) - 'brand' => 'car-type', + 'brand' => 'vehicle-type', 'category' => 'vehicle-category', - 'color' => 'color', - 'conditoin' => 'condition', - 'fuel' => 'fuel', - 'gearbox' => 'gearbox', - 'location' => 'location', - 'model' => 'car-type', + 'color' => 'vehicle-color', + 'conditoin' => 'vehicle-condition', + 'fuel' => 'vehicle-fuel', + 'gearbox' => 'vehicle-gearbox', + 'location' => 'vehicle-location', + 'model' => 'vehicle-type', 'type' => 'vehicle-category', ); static $meta_vars = array( // meta_name (name of post meta, stored in the database) => meta_keys (what is in the request) - 'car-horsepower' => array( + 'vehicle-horsepower' => array( 'start_horsepower', 'end_horsepower' ), - 'car-price' => array( + 'vehicle-price' => array( 'start_price', 'end_price' ), - 'car-range' => array( + 'vehicle-range' => array( 'start_range', 'end_range' ), - 'car-year' => array( + 'vehicle-year' => array( 'start_year', 'end_year' ), ); @@ -93,7 +93,7 @@ class Search { } $meta_query = array(); - + foreach( $this::$meta_vars as $meta_name => $meta_keys ) { if( ! empty( get_query_var( $meta_keys[0] ) ) || ! empty( get_query_var( $meta_keys[1] ) ) ) { $meta_query[] = $this->get_num_meta_array( $meta_name, get_query_var( $meta_keys[0] ), get_query_var( $meta_keys[1] ) ); |
