Foreach with Orderby by the Order field

Asked

Viewed 60 times

2

I’m trying to order by a foreach by the order of the categories but it won’t!

<ul class="categories-legend">
    <?php
        $args = array(
            'order' => 'DESC' //this is the default as well
        );
        $category = get_terms($args);

        foreach($dashboard_categories as $category):
            $color = carbon_get_term_meta($category->term_id, 'gp_category_color');
    ?>
    <li class="categories-legend-item" style="color:<?php echo $color;?>"><span><?php echo $category->name; ?></span></li>
    <?php endforeach; ?>
</ul>
  • How so you’re trying to make a orderBy of a foreach?

  • 2

    This foreach is not reversed?

  • Verdade @Darleifernandozillmer.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.