0
votes

I've a Wordpress theme with custom taxonomy and post type, I need the ability to set the order differently for each taxonomy in each post type.

For example I've "Hello World!" post that have this taxonomies "beginners, sentence, welcome message" And I've another post with the same taxonomies but I need this order "sentence, welcome message, beginners". How can I make another order for each post?

Thanks!

1

1 Answers

0
votes

You can order terms like this:

$taxonomies = get_terms( 'taxonomy', array(
    'orderby'    => 'whateveryoulike',
    'hide_empty' => 0
 ));

see http://codex.wordpress.org/Function_Reference/get_terms

...or, if you need more complex comparison, sort it using usort

$taxonomies = usort( get_terms( 'taxonomy' ), function($a ,$b){
   //compare a/b
});

see http://php.net/manual/en/function.usort.php