Created
August 18, 2014 14:48
-
-
Save DWboutin/9a892f6a3046a7919a03 to your computer and use it in GitHub Desktop.
Custom Order function WP_Query
This file contains hidden or 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 | |
function orderby( $a, $b ) { | |
global $posts; | |
$apos = get_field('niveau_academique', $a->ID); | |
$bpos = get_field('niveau_academique', $b->ID); | |
return ( $apos < $bpos ) ? -1 : 1; | |
} | |
usort( $projets->posts, "orderby" ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment