你需要潜入水中wp_dropdown_categories( $args );
和wp_list_categories
函数列出您的术语,即使我认为这不是更好的方式。对于手风琴,您需要编写自己的选择和选项条目,并使用自己的css/js,如Smooth accordion dropdown menu.
可以使用wp_dropdown_categories( $args );
.
要根据需要更改的参数列表:
$args = array(
\'show_option_all\' => \'\',
\'show_option_none\' => \'\',
\'option_none_value\' => \'-1\',
\'orderby\' => \'ID\',
\'order\' => \'ASC\',
\'show_count\' => 0,
\'hide_empty\' => 1,
\'child_of\' => 0,
\'exclude\' => \'\',
\'include\' => \'\',
\'echo\' => 1,
\'selected\' => 0,
\'hierarchical\' => 1,
\'name\' => \'cat\',
\'id\' => \'\',
\'class\' => \'postform scrollable-menu\',
\'depth\' => 0,
\'tab_index\' => 0,
\'taxonomy\' => \'category\',
\'hide_if_empty\' => false,
\'value_field\' => \'term_id\',
);
wp_dropdown_categories($args);
要使“选择”下拉列表可滚动,
.scrollable-menu {
height: auto;
max-height: 200px;
overflow-x: hidden;
}
希望对你有帮助!