Search
  • Sotware by
  • Christoph Amthor
Search Menu

Tag Groups Version 0.27: Natural Sorting And Bug Fixes

The main new feature of this release is the possibility to use natural sorting for tag names. You apply it with the shortcode parameter “orderby” and the value “natural”, instead of “name”. The entire shortcode could look like this:

[tag_groups_cloud orderby="natural"]

Sorting Numbers

So what does “natural sorting” actually mean? Natural sort order is a more intuitive order of names that contain numbers of various digits. For example, you usually sort 2 before 11 because you fill up all empty digits on the left with zeros: 02 is compared with 11, and obviously 0 is less than 1. Usual sorting, as done by the WordPress database machine, however, just compares all characters from left to right as they appear. 2 is greater than 1, and therefore 2 would be sorted behind 11, resulting in lists like this:

name1
name11
name12
name2
name21

With natural sorting, however, you get this:

name1
name2
name11
name12
name21

WordPress always uses natural sort order for its default tag cloud function (and widget) whenever you sort by “name”. I decided to keep “name” as “machine sort order”, since it’s not good practice to change the (intended) behaviour of a parameter with an update. Some users might simply want the order not to be “natural”.

Get the latest release from WordPress or through your automatic plugin updater, or read more about available shortcode parameters.

The new option will also appear in the shortcode of the premium plugin.

Photo by wojciechowskaek5

Share

Leave a Comment

Required fields are marked *.