Order Taxonomy Term by date created

Share Now

<?php
   $taxonomy = 'service-category';
   $terms = get_terms( $taxonomy, $args );
   
   $args = array(
   'orderby'    => 'ID', 
   'order'      => 'DESC',
   );
   
   if ( $terms && !is_wp_error( $terms ) ) :
   ?>
<?php foreach ( $terms as $term ) { ?>


<li data-filter-class="<?php echo create_slug($term->name); ?>">
   <?php $new_badge = get_field( 'is_new_badge_available',$term ); ?>
   <?php if( $new_badge == 1 ): ?>
   <img src= "<?php echo get_template_directory_uri(); ?>/assets/img/new-corner.png" alt="">
   <?php endif; ?>
   <?php echo $term->name; ?>
</li>


<?php } ?>
<?php endif;?>


Nahid Mahamud

Nahid Mahamud

Web Developer | Graphic Designer | WordPress & Woo-commerce Expert