adding php sort function to sort the counties in the search
authorAnthony Talarico <talarico@gaslightmedia.com>
Fri, 9 Jun 2017 16:01:05 +0000 (12:01 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Fri, 9 Jun 2017 16:01:05 +0000 (12:01 -0400)
adding uasort to order counties for header search dropdown and off canvas

functions.php
js/app.js
js/custom/headerSearch.js

index 9c2a819..ec178a7 100644 (file)
@@ -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');
index 35b24e2..cf844ad 100644 (file)
--- 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);
 
 
 
index 69c5710..203f670 100644 (file)
@@ -41,10 +41,10 @@ $(document).ready(function () {
         
 
     };
-    sortDropDownListByText('county-search', true);
-
-    
-    sortDropDownListByText('county-search', false);
+//    sortDropDownListByText('county-search', true);
+//
+//    
+//    sortDropDownListByText('county-search', false);