Display Custom Taxonomy Terns ordered by meta_value

Assuming the position field is filled with numbers to give order: have a look at ksort.

<?php 

            $terms = get_terms('brands');

            // Let's create our own array and then reorder it
            $order_terms = array();
            foreach( $terms as $term ) {
                $position = set_up_the_position_meta_here;
                $order_terms[$position] ='<h2>'.$term->name.'</h2>';
            }

            // now lets reorder the array based on keys (position)
            ksort($order_terms);

            // time to display
            foreach( $order_terms as $order_term ) {
                echo $order_term;
            }

        ?>

Leave a Comment