function hocwp_term_meta_different_name_field($taxonomies = array())
{
    global $pagenow;
    if ('edit-tags.php' == $pagenow || 'term.php' == $pagenow) {
        if (!hocwp_array_has_value($taxonomies)) {
            $taxonomies = get_taxonomies(array('public' => true));
        }
        $taxonomies = apply_filters('hocwp_term_different_name_field_taxonomies', $taxonomies);
        hocwp_exclude_special_taxonomies($taxonomies);
        if (!hocwp_array_has_value($taxonomies)) {
            $taxonomies = array('category');
        }
        $meta = new HOCWP_Meta('term');
        $meta->set_taxonomies($taxonomies);
        $meta->add_field(array('id' => 'different_name', 'label' => __('Different Name', 'hocwp-theme')));
        $meta->init();
    }
}
function hocwp_field_sortable_taxonomy($args = array())
{
    $value = isset($args['value']) ? $args['value'] : '';
    $items = isset($args['items']) ? $args['items'] : '';
    $connect = hocwp_get_value_by_key($args, 'connect', false);
    if (empty($items)) {
        $active_items = hocwp_json_string_to_array($value);
        $default_args = array('public' => true);
        $taxonomy_args = isset($args['taxonomy_args']) ? $args['taxonomy_args'] : array();
        $taxonomy_args = wp_parse_args($taxonomy_args, $default_args);
        $lists = get_taxonomies($taxonomy_args, 'objects');
        hocwp_exclude_special_taxonomies($lists);
        if ((bool) $connect) {
            foreach ($active_items as $aitem) {
                if (hocwp_array_has_value($aitem)) {
                    unset($lists[$aitem['id']]);
                }
            }
        } else {
            $results = hocwp_json_string_to_array($value);
            if (hocwp_array_has_value($results)) {
                $new_lists = array();
                foreach ($results as $data) {
                    $id = isset($data['id']) ? $data['id'] : '';
                    $item = get_taxonomy($id);
                    if (hocwp_object_valid($item) && taxonomy_exists($item)) {
                        foreach ($lists as $key => $taxonomy) {
                            if ($taxonomy->name == $item->name) {
                                $new_lists[] = $item;
                                unset($lists[$key]);
                                break;
                            }
                        }
                    }
                }
                $lists = $new_lists + $lists;
            }
        }
        foreach ($lists as $key => $list_item) {
            $li = new HOCWP_HTML('li');
            $li->set_class('ui-state-default');
            $attributes = array('data-id' => $key);
            $li->set_attribute_array($attributes);
            $li->set_text($list_item->labels->singular_name);
            $items .= $li->build();
        }
    }
    if ((bool) $connect) {
        $active_items = isset($args['active_items']) ? $args['active_items'] : '';
        if (empty($active_items)) {
            $lists = hocwp_json_string_to_array($value);
            foreach ($lists as $data) {
                $id = isset($data['id']) ? $data['id'] : '';
                $item = get_taxonomy($id);
                if (hocwp_object_valid($item) && isset($item->name) && taxonomy_exists($item->name)) {
                    $li = new HOCWP_HTML('li');
                    $li->set_class('ui-state-default');
                    $attributes = array('data-id' => $id);
                    $li->set_attribute_array($attributes);
                    $li->set_text($item->labels->singular_name);
                    $active_items .= $li->build();
                }
            }
        }
        $args['active_items'] = $active_items;
    }
    $args['items'] = $items;
    $class = isset($args['class']) ? $args['class'] : '';
    hocwp_add_string_with_space_before($class, 'taxonomy-sortable');
    $args['class'] = $class;
    hocwp_field_sortable($args);
}