From 7e7875cd3fe149c5ec5fd8ae7b08e708e00fc352 Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Fri, 9 Jun 2017 12:01:05 -0400 Subject: [PATCH] adding php sort function to sort the counties in the search adding uasort to order counties for header search dropdown and off canvas --- functions.php | 7 +++++++ js/app.js | 8 ++++---- js/custom/headerSearch.js | 8 ++++---- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/functions.php b/functions.php index 9c2a819..ec178a7 100644 --- a/functions.php +++ b/functions.php @@ -365,6 +365,13 @@ add_filter('member_list_header_search', function(){ $regions = get_categories_array( apply_filters('glm_getListForSearch', 'region'), 'region'); $cities = get_categories_array( apply_filters('glm_getListForSearch', 'city'), 'city'); $counties = get_categories_array( apply_filters('glm_getListForSearch', 'county'), 'county'); + + uasort($counties, function ($item1, $item2) { + if ($item1['name'] == $item2['name']) return 0; + return $item1['name'] < $item2['name'] ? -1 : 1; + }); + + $parks = get_categories_array( apply_filters('glm_getListForSearch','category', "Parks"), 'category'); $activities = get_categories_array( apply_filters('glm_getListForSearch','category', "Activities"), 'category'); $destinations = get_categories_array( apply_filters('glm_getListForSearch','category', "Destinations"), 'category'); diff --git a/js/app.js b/js/app.js index 35b24e2..cf844ad 100644 --- a/js/app.js +++ b/js/app.js @@ -50,10 +50,10 @@ $(document).ready(function () { }; - sortDropDownListByText('county-search', true); - - - sortDropDownListByText('county-search', false); +// sortDropDownListByText('county-search', true); +// +// +// sortDropDownListByText('county-search', false); diff --git a/js/custom/headerSearch.js b/js/custom/headerSearch.js index 69c5710..203f670 100644 --- a/js/custom/headerSearch.js +++ b/js/custom/headerSearch.js @@ -41,10 +41,10 @@ $(document).ready(function () { }; - sortDropDownListByText('county-search', true); - - - sortDropDownListByText('county-search', false); +// sortDropDownListByText('county-search', true); +// +// +// sortDropDownListByText('county-search', false); -- 2.17.1