Order with get_categories()
-
I’m building a custom list of Categories (because I’ve used ACF to add fields to them), and if not set the
orderby
ororder
parameters in the arguments. Here’s is the code:$args = array( 'hide_empty' => false, 'taxonomy' => 'category', ); $cats = get_categories( $args ); foreach( $cats as $cat ) { $icon = get_field( 'category_icon', $cat ); echo '<li><i class="' . $icon . '"></i> <a href="' . get_category_link( $cat->term_id ) . '">' . $cat->name . '</a></li>'; }
The list that prints is not using the order I’ve set with this plugin. What do I need to set
orderby
to in the $args?Thank you
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Order with get_categories()’ is closed to new replies.