How To Dual-Sort Query Results In WordPress Using get_posts

Author: , September 12th, 2019

Needed to build a feature for a Bookstore tool to have an optional sequence number for the Custom Post Type “books” that would allow items with a seq number to float to the top of the list and be sorted by seq #. The rest of the books would show underneath, sorted alphabetically.

How To List Running AWS Instances in all Regions Sorted by LaunchTime and Email in a Monospaced Font

Author: , July 1st, 2019

How To Select the Max Numeric in a Varchar Column in MySQL

Author: , October 2nd, 2015

I needed to automate the addition of new users with a sequential member’s ID in WordPress. Additionally, there were non-numeric entries in that column that had to be ignored. The wp_users.user_login column is a varchar(60) and so does not naturally handle numeric operations well at all. The solution is a combination of REGEXP and cast(): […]

How To Sort Text as a Number in MySQL

Author: , July 11th, 2013

select theField from theTable order by theField+0; ~OR~ select theField from theTable order by CAST(theField AS UNSIGNED);

How To Disable Sort in DataTables

Author: , July 10th, 2013

To turn off Sort completely, use the ‘bSort’: false option. To have sorting turned off to begin with, but the user can still click on the columns to sort, use the ‘aaSorting’: [] (i.e. empty array) option. Happy Coding!

How To Return Line Numbers In MySQL

Author: , October 14th, 2011

How To Select Random Records Using MySQL

Author: , September 28th, 2011

How to Sort Arrays in PHP

Author: , September 29th, 2009

There are 4 “key” functions for dealing with PHP array sorting. These four have the significant feature of keeping the associated key/value relationships intact. asort() – sort by value ascending arsort()– sort by value descending ksort()– sort by key ascending krsort() – sort by key descending For more information check out this php man page […]