Skip to content

Instantly share code, notes, and snippets.

@kadimi
Created January 9, 2019 22:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kadimi/053db49647aab68861df06ed14d99577 to your computer and use it in GitHub Desktop.
Save kadimi/053db49647aab68861df06ed14d99577 to your computer and use it in GitHub Desktop.
<?php
// Add this code to your custom template event-results.php, after $data has been filled
$orderBy = 'goals';
$order = 'ASC'; // Or DESC
uasort( $data, function( $a, $b ) use ( $orderBy, $order ) {
return $order === 'DESC'
? $a[ $orderBy ] < $b [ $orderBy ]
: $a[ $orderBy ] > $b [ $orderBy ]
;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment