From: Anthony Talarico Date: Fri, 9 Jun 2017 16:01:05 +0000 (-0400) Subject: adding php sort function to sort the counties in the search X-Git-Tag: v1.0.0^2~39 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=7e7875cd3fe149c5ec5fd8ae7b08e708e00fc352;p=WP-Themes%2Fmichigantrailmaps.git adding php sort function to sort the counties in the search adding uasort to order counties for header search dropdown and off canvas --- 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);