通过单击扩展/折叠类别

时间:2018-10-25 15:02:03

标签: php wordpress

在wp中,我有一个返回所有类别的代码,它们的子代已扩展。这是代码:

public static function draw_term_childs($type = 'select', $mdf_parent_id = 0, $selected_id = 0, $tax_name = 0, $is_ajax = true, $hide_string_ids = '', $widget_options = array()) {
        $hide = array();
        if (!empty($hide_string_ids)) {
            $hide = explode(',', $hide_string_ids);
        }
//+++
        $hide_empty = false;
//taxonomies_options_hide_terms_0
        if (isset($widget_options['taxonomies_options_hide_terms_0'])) {
            $hide_empty = (bool) ($widget_options['taxonomies_options_hide_terms_0']);
        }
//print_r($widget_options);
        $terms = self::get_terms($tax_name, $hide_empty, false, 0, $mdf_parent_id);
        switch ($type) {
            case 'select':
                self::draw_term_childs_select($terms, $mdf_parent_id, $selected_id, $hide, $tax_name, $is_ajax, $hide_string_ids, $widget_options);
                break;
            case 'checkbox':
                self::draw_term_childs_checkbox($terms, $mdf_parent_id, (array) $selected_id, $hide, $tax_name, $is_ajax, $hide_string_ids, $widget_options);
                break;
            case 'label':
                self::draw_term_childs_label($terms, $mdf_parent_id, (array) $selected_id, $hide, $tax_name, $is_ajax, $hide_string_ids, $widget_options);
                break;
            case 'multi_select':
                self::draw_term_multi_select($terms, $mdf_parent_id, (array) $selected_id, $hide, $tax_name, $is_ajax, $hide_string_ids, $widget_options);
                break;
            default:
                break;
        }
    }

是否可以先显示它们折叠并仅扩展我单击的那些?

0 个答案:

没有答案