Permalink
Browse files

Merge pull request #3 from radgeek/master

Isotope Filters / Fix wonky sorting
  • Loading branch information...
2 parents 102dd3c + 14f3de8 commit 98f633ac2e0772bd69f878875a16f4a3c0b355ca @radgeek radgeek committed Nov 17, 2012
Showing with 11 additions and 5 deletions.
  1. +11 −5 page-show-cards.php
View
@@ -137,16 +137,22 @@ function options_filter_ul ($filters, $axis) {
// Here is a way to clean up label text that you do not like.
$filterMap['type']['text'] = array('unknown' => 'Other');
-// Force the unknown / other settings to bottom.
+// Sort these by # of cards, with blanks sorted down to the end.
if (isset($filters['state']['values'][''])) :
$filters['state']['values'][''] = 0;
endif;
-$filters['type']['values']['unknown'] = 0;
-$filters['region']['values']['Other/region-other'] = 0;
-
arsort($filters['state']['values']);
+
+$filters['type']['values']['unknown'] = 0;
arsort($filters['type']['values']);
-arsort($filters['region']['values']);
+
+// Sort A-Z, with "Other" forced down to the end.
+uksort($filters['region']['values'], function ($left, $right) {
+ // Force "Other" to end of alpha order
+ $a = (('region-other'==$left) ? '{|}' : $left);
+ $b = (('region-other'==$right) ? '{|}' : $right);
+ return strcmp($a, $b);
+});
//////////////////////////////////////////////////////
// HEADER: This kind of page requires some scripts. //

0 comments on commit 98f633a

Please sign in to comment.