Support MB Custom Post Type Select tree fail again Reply To: Select tree fail again

#13346
clientes@interficto.com[email protected]
Participant

Yes is similar, is possible that you overwrited the commit:

https://github.com/wpmetabox/meta-box/commit/dbf1fa0e96be73b0c6b68e31a2d64ba72455fef3

in the commit:
https://github.com/wpmetabox/meta-box/commit/b76fd9be7861908151bfd2c88e19361d5fd4035f

add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' );
function your_prefix_register_meta_boxes( $meta_boxes ) {
    $meta_boxes[] = array (
        'title' => 'Características V2',
        'id' => 'caracteristicas-v2',
        'post_types' => array(
            0 => 'propiedad',
        ),
        'context' => 'after_title',
        'priority' => 'high',
        'autosave' => true,
        'fields' => array(
            array (
                'id' => 'codigo',
                'type' => 'text',
                'name' => 'Código',
                'tab' => 'tab_1',
            ),
            array (
                'id' => 'ubicacion',
                'type' => 'taxonomy',
                'name' => 'Ubicación',
                'taxonomy' => 'ubicacion',
                'field_type' => 'select_tree',
                'required' => 1,
                'tab' => 'tab_1',
            ),
            array (
                'id' => 'precio',
                'type' => 'number',
                'name' => 'Precio',
                'tab' => 'tab_1',
            ),
            array (
                'id' => 'tipo_negocio',
                'type' => 'taxonomy',
                'name' => 'Tipo de negocio',
                'taxonomy' => 'tipo-de-negocio',
                'field_type' => 'select',
                'tab' => 'tab_1',
            ),
            array (
                'id' => 'tipo_propiedad',
                'type' => 'taxonomy',
                'name' => 'Tipo de propiedad',
                'taxonomy' => 'tipo-de-propiedad',
                'field_type' => 'select',
                'tab' => 'tab_1',
            ),
            array (
                'id' => 'destacada',
                'name' => 'Destacada',
                'type' => 'select',
                'placeholder' => 'Select an Item',
                'options' => array(
                    1 => 'Si',
                    2 => 'No',
                ),
                'tab' => 'tab_1',
            ),
            array (
                'id' => 'estrato',
                'type' => 'text',
                'name' => 'Estrato',
                'tab' => 'tab_5',
            ),
            array (
                'id' => 'admisitracion',
                'type' => 'text',
                'name' => 'Administración',
                'tab' => 'tab_5',
            ),
            array (
                'id' => 'avaluo_catastral',
                'type' => 'text',
                'name' => 'Avalúo Catastral',
                'tab' => 'tab_5',
            ),
            array (
                'id' => 'predial',
                'type' => 'text',
                'name' => 'Predial',
                'tab' => 'tab_5',
            ),
            array (
                'id' => 'total_pisos',
                'type' => 'text',
                'name' => 'Total de pisos',
                'tab' => 'tab_5',
            ),
            array (
                'id' => 'numero_niveles',
                'type' => 'text',
                'name' => 'Número de niveles',
                'tab' => 'tab_5',
            ),
            array (
                'id' => 'piso_numero',
                'type' => 'text',
                'name' => 'Piso número',
                'tab' => 'tab_5',
            ),
            array (
                'id' => 'clase_piso',
                'type' => 'text',
                'name' => 'Clase de piso',
                'tab' => 'tab_5',
            ),
            array (
                'id' => 'area_construida',
                'type' => 'text',
                'name' => 'Área construida',
                'tab' => 'tab_5',
            ),
            array (
                'id' => 'area_total',
                'type' => 'text',
                'name' => 'Área total',
                'tab' => 'tab_5',
            ),
            array (
                'id' => 'ano_construido',
                'type' => 'text',
                'name' => 'Año construido',
                'tab' => 'tab_5',
            ),
            array (
                'id' => 'undiad',
                'type' => 'text',
                'name' => 'Unidad Cerrada',
                'tab' => 'tab_5',
            ),
            array (
                'id' => 'ascensor',
                'type' => 'text',
                'name' => 'Ascensor',
                'tab' => 'tab_5',
            ),
            array (
                'id' => 'garaje',
                'type' => 'text',
                'name' => 'Garaje',
                'tab' => 'tab_5',
            ),
            array (
                'id' => 'piscina',
                'type' => 'text',
                'name' => 'Piscina',
                'tab' => 'tab_5',
            ),
            array (
                'id' => 'parqueadero',
                'type' => 'text',
                'name' => 'Parqueadero',
                'tab' => 'tab_5',
            ),
            array (
                'id' => 'banos',
                'type' => 'number',
                'name' => 'Baños',
                'tab' => 'tab_5',
            ),
            array (
                'id' => 'parqueadero_visitantes',
                'type' => 'text',
                'name' => 'Parqueadero Visitantes',
                'tab' => 'tab_5',
            ),
            array (
                'id' => 'habitaciones',
                'type' => 'number',
                'name' => 'Habitaciones',
                'tab' => 'tab_5',
            ),
            array (
                'id' => 'zona',
                'type' => 'text',
                'name' => 'Zona',
                'tab' => 'tab_5',
            ),
            array (
                'id' => 'decripcion',
                'name' => 'Descripción de la propiedad',
                'type' => 'wysiwyg',
                'required' => 1,
                'tab' => 'tab_29',
            ),
            array (
                'id' => 'sector',
                'name' => 'Descripción del sector',
                'type' => 'wysiwyg',
                'tab' => 'tab_31',
            ),
            array (
                'id' => 'galeria',
                'type' => 'image_advanced',
                'name' => 'Galería de imágenes',
                'max_file_uploads' => 20,
                'image_size' => 'thumbnail',
                'tab' => 'tab_34',
            ),
        ),
        'tab_style' => 'default',
        'tab_wrapper' => true,
        'tabs' => array(
            'tab_1' => array(
                'label' => 'Caracteristicas principales',
                'icon' => 'dashicons-admin-generic',
            ),
            'tab_5' => array(
                'label' => 'Características secundarias',
                'icon' => 'dashicons-admin-tools',
            ),
            'tab_29' => array(
                'label' => 'Descripción de la propiedad',
                'icon' => 'dashicons-editor-justify',
            ),
            'tab_31' => array(
                'label' => 'Descripción del sector',
                'icon' => 'dashicons-location',
            ),
            'tab_34' => array(
                'label' => 'Imagenes',
                'icon' => 'dashicons-camera',
            ),
        ),
    );
    return $meta_boxes;
}

Taxonomies


function ubicaciones_register_taxonomy() {

    $args = array (
        'label' => esc_html__( 'Ubicaciones', 'propiedades' ),
        'labels' => array(
            'menu_name' => esc_html__( 'Ubicaciones', 'propiedades' ),
            'all_items' => esc_html__( 'Todas las Ubicaciones', 'propiedades' ),
            'edit_item' => esc_html__( 'Editar Ubicación', 'propiedades' ),
            'view_item' => esc_html__( 'Ver ubicación', 'propiedades' ),
            'update_item' => esc_html__( 'Actuailzar Ubicación', 'propiedades' ),
            'add_new_item' => esc_html__( 'Agregar nueva ubicación', 'propiedades' ),
            'new_item_name' => esc_html__( 'Nueva ubicación', 'propiedades' ),
            'parent_item' => esc_html__( 'Ubicación padre', 'propiedades' ),
            'parent_item_colon' => esc_html__( 'Ubicación padre:', 'propiedades' ),
            'search_items' => esc_html__( 'Buscar ubicaciones', 'propiedades' ),
            'popular_items' => esc_html__( 'Ubicaciones populares', 'propiedades' ),
            'separate_items_with_commas' => esc_html__( 'Separar ubicaciones con coma', 'propiedades' ),
            'add_or_remove_items' => esc_html__( 'Agregar o remover ubicación', 'propiedades' ),
            'choose_from_most_used' => esc_html__( 'Elegir las ubicación más usadas', 'propiedades' ),
            'not_found' => esc_html__( 'No se encontraron ubicaciones', 'propiedades' ),
            'name' => esc_html__( 'Ubicaciones', 'propiedades' ),
            'singular_name' => esc_html__( 'Ubicación', 'propiedades' ),
        ),
        'public' => true,
        'show_ui' => true,
        'show_in_menu' => true,
        'show_in_nav_menus' => true,
        'show_tagcloud' => false,
        'show_in_quick_edit' => true,
        'show_admin_column' => true,
        'show_in_rest' => false,
        'hierarchical' => true,
        'query_var' => true,
        'sort' => false,
        'rewrite_no_front' => false,
        'rewrite_hierarchical' => true,
        'rewrite' => true,
    );

    register_taxonomy( 'ubicacion', array( 'propiedad' ), $args );
}
add_action( 'init', 'ubicaciones_register_taxonomy', 0 );