Last active
September 19, 2016 23:53
-
-
Save adamplabarge/dd6c0f32d13adbdb8ddb890e314d77d1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$highlights = new WP_Query($args); | |
$sort = function(&$posts) { | |
$props = array('year', 'authors'); | |
usort($posts, function($a, $b) use ($props) { | |
if ($a->$props[0] == $b->$props[0]) | |
return $a->$props[1] > $b->$props[1] ? 1 : -1; | |
return $a->$props[0] < $b->$props[0] ? 1 : -1; | |
}); | |
}; | |
$sort($highlights->posts); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment