UASORT on the cities/counties in the top-search
authorLaury GvR <laury@gaslightmedia.com>
Tue, 22 Aug 2017 17:26:26 +0000 (13:26 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Tue, 22 Aug 2017 17:26:26 +0000 (13:26 -0400)
Uasort function applied to the arrays used to populate the cities
and counties in the top-search to make sure they're alpha-ordered.

functions.php

index e066afd..66626cf 100644 (file)
@@ -366,12 +366,19 @@ add_filter('member_list_header_search', function(){
     $cities = get_categories_array( apply_filters('glm_getListForSearch', 'city'), 'city');
     $counties = get_categories_array( apply_filters('glm_getListForSearch', 'county'), 'county');
 
+    uasort($regions, function ($item1, $item2) {
+        if ($item1['name'] == $item2['name']) return 0;
+        return $item1['name'] < $item2['name'] ? -1 : 1;
+    });
+    uasort($cities, function ($item1, $item2) {
+        if ($item1['name'] == $item2['name']) return 0;
+        return $item1['name'] < $item2['name'] ? -1 : 1;
+    });
     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');