0

I have to sort my results by number:

<ul>
 <?php $productTerms = get_terms('prezzoceste', array('hide_empty' => 0, 'orderby' => 'ASC', 'meta_type' => 'NUMERIC', ));
foreach($productTerms as $productTerm) :
?>
<li>
<i class="fas fa-circle"></i>
<a href="<?php echo get_term_link( $productTerm->slug, $productTerm->taxonomy ); ?>"><?php echo $productTerm->name; ?> <span>(<?php echo $productTerm->count; ?>)</span></a>
</li>
<?php endforeach; ?>
</ul>

enter image description here

1 Answer 1

1

You are using pre 4.5.0 code which will eventually be depricated. Try this.

$productTerms = get_terms( array(
    'taxonomy' => 'prezzoceste',
    'hide_empty' => false,
    'orderby' => 'ASC',
    'meta_key' => '_price', //The price Meta Key
    'orderby' => 'meta_value_num',
) );

Check this for more accepted arguments.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.