Need ALM query with natural (alphanumeric) ordering of post titles
-
I’ve been wrestling with this for a long time now. I’ve Googled it to death and tried tons of different hooks and actions. I can’t seem to get this working right with ALM.
Basically, I need my ALM query to orderby title, except using natural sorting.
For example, instead of Title 10, Title 1, Title 2…
It would be Title 1, Title 2, Title 10…
If I make my own WP_Query, I can achieve this easily with:
usort($query->posts, function($a, $b) { return strnatcasecmp($a->post_name,$b->post_name); });
Just by sticking that after the query is executed but before the loop. However when I try to use the same technique with ALM I get some really strange results.
Is there any way I can hack this same functionality into ALM?
Thanks so much in advance.
- The topic ‘Need ALM query with natural (alphanumeric) ordering of post titles’ is closed to new replies.