我有一个在标题中搜索的网站(anunciaya.es)。我想按名称ASC/DESC订购wp\\U下拉列表\\U类别,但它不适合我。
\'排序依据\'=>;\'“名称”和“顺序”=>;\'DESC不适合我。有什么解决方案吗?
以下是PHP代码:
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,
) );
谢谢你!!
SO网友:Ariel
希望在放置order和orderby时语法是正确的。在理论上,您的代码应该使用以下内容
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\'
) );