admin管理员组文章数量:1289529
I have a website with a search in header (anunciaya.es) . I want to order the wp_dropdown_categories by NAME ASC/DESC but it does not work for me.
'orderby' => 'name', and 'order' => 'DESC', is not working for me. Any solution?
Here is the PHP code:
wp_dropdown_categories( array(
'show_option_none' => $cat_text,
'option_none_value' => '',
'taxonomy' => rtcl()->category,
'name' => 'rtcl_category',
'id' => 'rtcl-category-search-' . wp_rand(),
'class' => 'form-control rtcl-category-search',
'selected' => get_query_var( 'rtcl_category' ),
'hierarchical' => true,
'value_field' => 'slug',
'depth' => Functions::get_category_depth_limit(),
'show_count' => false,
'hide_empty' => false,
) );
Thank you!!
I have a website with a search in header (anunciaya.es) . I want to order the wp_dropdown_categories by NAME ASC/DESC but it does not work for me.
'orderby' => 'name', and 'order' => 'DESC', is not working for me. Any solution?
Here is the PHP code:
wp_dropdown_categories( array(
'show_option_none' => $cat_text,
'option_none_value' => '',
'taxonomy' => rtcl()->category,
'name' => 'rtcl_category',
'id' => 'rtcl-category-search-' . wp_rand(),
'class' => 'form-control rtcl-category-search',
'selected' => get_query_var( 'rtcl_category' ),
'hierarchical' => true,
'value_field' => 'slug',
'depth' => Functions::get_category_depth_limit(),
'show_count' => false,
'hide_empty' => false,
) );
Thank you!!
Share Improve this question edited Jul 28, 2021 at 14:20 fuxia♦ 107k38 gold badges255 silver badges459 bronze badges asked Jul 28, 2021 at 13:41 woofreelancewoofreelance 11 Answer
Reset to default 0Hopefully your syntax was correct when you placed order and orderby. In thoery, your code should work with the following
wp_dropdown_categories( array(
'show_option_none' => $cat_text,
'option_none_value' => '',
'taxonomy' => rtcl()->category,
'name' => 'rtcl_category',
'id' => 'rtcl-category-search-' . wp_rand(),
'class' => 'form-control rtcl-category-search',
'selected' => get_query_var( 'rtcl_category' ),
'hierarchical' => true,
'value_field' => 'slug',
'depth' => Functions::get_category_depth_limit(),
'show_count' => false,
'hide_empty' => false,
'orderby' => 'name',
'order' => 'DESC'
) );
本文标签: categoriesOrder wpdropdowncategories by ASC or DESC
版权声明:本文标题:categories - Order wp_dropdown_categories by ASC or DESC 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741414929a2377455.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论