Подскажите как настроить порядок самоформируешгося каталога разделов?
<section class="main__category">
<div class="container">
<div class="section__title">Категории товаров</div>
<div class="main__category-wrap">
<?php
$taxonomy = 'product_cat';
$orderby = 'menu_order';
$show_count = 0;
$pad_counts = 0;
$hierarchical = 1;
$title = '';
$empty = 0;
$args = array(
'taxonomy' => $taxonomy,
'orderby' => $orderby,
'show_count' => $show_count,
'pad_counts' => $pad_counts,
'hierarchical' => $hierarchical,
'title_li' => $title,
'hide_empty' => $empty
);
$all_categories = get_categories( $args );
$i = 1;
foreach ($all_categories as $k => $cat):
if($cat->category_parent == 0):
$category_id = $cat->term_id;
if ($i < 11):
?>
<a href="<? echo get_term_link($cat->slug, 'product_cat'); ?>" class="main__category-item main__category-item-visible <? echo ($i % 5 == 0) ? 'last' : ''; ?>">
<h3 class="main__category-title"><? echo $cat->name; ?></h3>
<img src="<? echo wp_get_attachment_url(get_woocommerce_term_meta($category_id, 'thumbnail_id', true)); ?>" alt="" class="main__category-img">
</a>
<?
else:
?>
<a href="<? echo get_term_link($cat->slug, 'product_cat'); ?>" class="main__category-item <? echo ($i % 5 == 0) ? 'last' : ''; ?>">
<h3 class="main__category-title"><? echo $cat->name; ?></h3>
<img src="<? echo wp_get_attachment_url(get_woocommerce_term_meta($category_id, 'thumbnail_id', true)); ?>" alt="" class="main__category-img">
</a>
<?
endif;
$i++;
endif;
endforeach;
?>
</div>
<div class="more__link more__link-category">
<span data-swap="Свернуть" data-text="Показать больше категорий">Показать больше категорий</span>
<svg width="15" height="8" viewBox="0 0 15 8" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M1 1L6.82172 6.3739C7.20478 6.72749 7.79522 6.72749 8.17828 6.3739L14 1" stroke-width="1.5" stroke-linecap="round"/>
</svg>
</div>
</div>
</section>