Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- add_action( 'init', function() {
- if ( class_exists( 'RWMB_Field' ) ) {
- class RWMB_Versiones_Field extends RWMB_Field {
- public static function html( $meta, $field ) {
- $html = '';
- $html .= '<select name="' . $field['field_name'] . '" id ="' . $field['id'] . '" class="rwmb">';
- //$html .= "<select data-options=\"{'allowClear':true,'width':'none','placeholder':'Select an Item'}\" id=\"select_advanced_5u4qbea9f9q\" class=\"rwmb-select_advanced select2-hidden-accessible\" name=\"select_advanced_5u4qbea9f9q\" data-select2-id=\"select_advanced_5u4qbea9f9q\" tabindex=\"-1\" aria-hidden=\"true\">";
- //$html .= '<select data-options="{"allowClear":true,"width":"none","placeholder":"Select an Item"}" class="rwmb rwmb-select_advanced select2-hidden-accessible" data-select2-id="' . $field['id'] . '" id="' . $field['id'] . '" name="' . $field['field_name'] . '" tabindex="-1" aria-hidden="true">';
- foreach($GLOBALS['versiones'] as $key => $value){
- $selected = ($value['vers_id']==$meta)?' selected':'';
- $html .= '<option value="' . $value['vers_id'] . '"' . $selected . '>' . $value['vers_nombre'] . '</option>';
- }
- $html .= '</select>';
- return $html;
- }
- }
- }
- } );
- add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes1' );
- function your_prefix_register_meta_boxes1( $meta_boxes ) {
- $prefix = '';
- $meta_boxes[] = array (
- 'title' => esc_html__( 'Vehículos - Configuración2', 'text-domain' ),
- 'id' => 'vehiculos-configuracion2',
- 'post_types' => array(
- 0 => 'vehiculo',
- ),
- 'context' => 'normal',
- 'priority' => 'high',
- 'fields' => array(
- array (
- 'id' => 'grupo_versiones',
- 'type' => 'group',
- 'name' => esc_html__( 'Versiones', 'text-domain' ),
- 'fields' => array(
- array(
- 'name' => 'Seleccione una versión',
- 'id' => 'if_versiones_version_id',
- 'type' => 'versiones',
- 'columns' => 4,
- ),
- array (
- 'id' => 'if_versiones_version_hotspot',
- 'name' => esc_html__( 'Hotspot', 'text-domain' ),
- 'type' => 'text',
- 'columns' => 4,
- ),
- array (
- 'id' => $prefix . 'if_versiones_version_ficha',
- 'type' => 'file_input',
- 'name' => esc_html__( 'Ficha técnica versión', 'text-domain' ),
- 'columns' => 4,
- ),
- array (
- 'id' => 'if_versiones_version_descripcion',
- 'name' => esc_html__( 'Descripción', 'text-domain' ),
- 'type' => 'wysiwyg',
- 'columns' => 12,
- ),
- ),
- 'clone' => 1,
- 'default_state' => 'expanded',
- 'tab' => 'if_vehiculos_tab_general2',
- ),
- ),
- 'tab_style' => 'left',
- 'tab_wrapper' => true,
- 'tabs' => array(
- 'if_vehiculos_tab_general2' => array(
- 'label' => 'General',
- 'icon' => 'dashicons-admin-generic',
- ),
- ),
- );
- return $meta_boxes;
- }
- function your_prefix_register_post_type2() {
- $args = array (
- 'label' => esc_html__( 'Detalle de Vehiculos', 'text-domain' ),
- 'labels' => array(
- 'menu_name' => esc_html__( 'Detalle de Vehiculos', 'text-domain' ),
- 'name_admin_bar' => esc_html__( 'Detalle de Vehiculo', 'text-domain' ),
- 'add_new' => esc_html__( 'Agregar nuevo', 'text-domain' ),
- 'add_new_item' => esc_html__( 'Agregar nuevo Detalle de Vehiculo', 'text-domain' ),
- 'new_item' => esc_html__( 'Nuevo Detalle de Vehiculo', 'text-domain' ),
- 'edit_item' => esc_html__( 'Editar Detalle de Vehiculo', 'text-domain' ),
- 'view_item' => esc_html__( 'Ver Detalle de Vehiculo', 'text-domain' ),
- 'update_item' => esc_html__( 'Update Detalle de Vehiculo', 'text-domain' ),
- 'all_items' => esc_html__( 'Todos Detalle de Vehiculos', 'text-domain' ),
- 'search_items' => esc_html__( 'Buscar Detalle de Vehiculos', 'text-domain' ),
- 'parent_item_colon' => esc_html__( 'Detalle de vehículo padre', 'text-domain' ),
- 'not_found' => esc_html__( 'No se encontró Detalle', 'text-domain' ),
- 'not_found_in_trash' => esc_html__( 'No se encontró Detalle en la papelera', 'text-domain' ),
- 'name' => esc_html__( 'Detalle de Vehiculos', 'text-domain' ),
- 'singular_name' => esc_html__( 'Detalle de Vehiculo', 'text-domain' ),
- ),
- 'public' => true,
- 'exclude_from_search' => false,
- 'publicly_queryable' => true,
- 'show_ui' => true,
- 'show_in_nav_menus' => true,
- 'show_in_menu' => 'edit.php?post_type=vehiculo',
- 'show_in_admin_bar' => true,
- 'show_in_rest' => true,
- 'menu_icon' => 'dashicons-universal-access-alt',
- 'capability_type' => 'page',
- 'hierarchical' => false,
- 'has_archive' => true,
- 'query_var' => true,
- 'can_export' => true,
- 'rewrite_no_front' => false,
- 'supports' => array(
- 'title',
- 'editor',
- 'thumbnail',
- 'revisions',
- ),
- 'rewrite' => true,
- );
- register_post_type( 'detalle-de-vehiculo', $args );
- }
- add_action( 'init', 'your_prefix_register_post_type2' );
- function your_prefix_register_post_type3() {
- $args = array (
- 'label' => esc_html__( 'Accesorios', 'text-domain' ),
- 'labels' => array(
- 'menu_name' => esc_html__( 'Accesorios', 'text-domain' ),
- 'name_admin_bar' => esc_html__( 'Accesorio', 'text-domain' ),
- 'add_new' => esc_html__( 'Agregar', 'text-domain' ),
- 'add_new_item' => esc_html__( 'Agregar Nuevo Accesorio', 'text-domain' ),
- 'new_item' => esc_html__( 'Nuevo Accesorio', 'text-domain' ),
- 'edit_item' => esc_html__( 'Editar Accesorio', 'text-domain' ),
- 'view_item' => esc_html__( 'Ver Accesorio', 'text-domain' ),
- 'update_item' => esc_html__( 'Update Accesorio', 'text-domain' ),
- 'all_items' => esc_html__( 'Todos los Accesorios', 'text-domain' ),
- 'search_items' => esc_html__( 'Buscar Accesorios', 'text-domain' ),
- 'parent_item_colon' => esc_html__( 'Accesorio padre', 'text-domain' ),
- 'not_found' => esc_html__( 'No se encontraron accesorios', 'text-domain' ),
- 'not_found_in_trash' => esc_html__( 'No se encontraron accesorios en la papelera', 'text-domain' ),
- 'name' => esc_html__( 'Accesorios', 'text-domain' ),
- 'singular_name' => esc_html__( 'Accesorio', 'text-domain' ),
- ),
- 'public' => true,
- 'exclude_from_search' => false,
- 'publicly_queryable' => true,
- 'show_ui' => true,
- 'show_in_nav_menus' => true,
- 'show_in_menu' => true,
- 'show_in_admin_bar' => true,
- 'show_in_rest' => true,
- 'menu_position' => 2,
- 'menu_icon' => 'dashicons-admin-appearance',
- 'capability_type' => 'post',
- 'hierarchical' => false,
- 'has_archive' => 'accesorios',
- 'query_var' => true,
- 'can_export' => true,
- 'rewrite_no_front' => false,
- 'supports' => array(
- 'title',
- 'editor',
- 'thumbnail',
- ),
- 'rewrite' => true,
- );
- register_post_type( 'accesorio', $args );
- }
- add_action( 'init', 'your_prefix_register_post_type3' );
- function your_prefix_register_post_type4() {
- $args = array (
- 'label' => esc_html__( 'Vehículos', 'text-domain' ),
- 'labels' => array(
- 'menu_name' => esc_html__( 'Vehículos', 'text-domain' ),
- 'name_admin_bar' => esc_html__( 'Vehículo', 'text-domain' ),
- 'add_new' => esc_html__( 'Nuevo', 'text-domain' ),
- 'add_new_item' => esc_html__( 'Nuevo Vehículo', 'text-domain' ),
- 'new_item' => esc_html__( 'Nuevo Vehículo', 'text-domain' ),
- 'edit_item' => esc_html__( 'Editar Vehículo', 'text-domain' ),
- 'view_item' => esc_html__( 'Ver Vehículo', 'text-domain' ),
- 'update_item' => esc_html__( 'Update Vehículo', 'text-domain' ),
- 'all_items' => esc_html__( 'Todos los Vehículos', 'text-domain' ),
- 'search_items' => esc_html__( 'BuscarVehículos', 'text-domain' ),
- 'parent_item_colon' => esc_html__( 'Vehículo padre', 'text-domain' ),
- 'not_found' => esc_html__( 'No se encontraron vehículos', 'text-domain' ),
- 'not_found_in_trash' => esc_html__( 'No se encontraron vehículos en la papelera', 'text-domain' ),
- 'name' => esc_html__( 'Vehículos', 'text-domain' ),
- 'singular_name' => esc_html__( 'Vehículo', 'text-domain' ),
- ),
- 'public' => true,
- 'exclude_from_search' => false,
- 'publicly_queryable' => true,
- 'show_ui' => true,
- 'show_in_nav_menus' => true,
- 'show_in_menu' => true,
- 'show_in_admin_bar' => true,
- 'show_in_rest' => true,
- 'menu_position' => 20,
- 'menu_icon' => 'dashicons-dashboard',
- 'capability_type' => 'post',
- 'hierarchical' => false,
- 'has_archive' => true,
- 'query_var' => true,
- 'can_export' => true,
- 'supports' => array(
- 'title',
- 'editor',
- 'thumbnail',
- 'excerpt',
- 'revisions',
- ),
- 'rewrite' => array(
- 'with_front' => false,
- ),
- );
- register_post_type( 'vehiculo', $args );
- }
- add_action( 'init', 'your_prefix_register_post_type4' );
- function your_prefix_register_taxonomy5() {
- $args = array (
- 'label' => esc_html__( 'Familias', 'text-domain' ),
- 'labels' => array(
- 'menu_name' => esc_html__( 'Familias', 'text-domain' ),
- 'all_items' => esc_html__( 'Todas las Familias', 'text-domain' ),
- 'edit_item' => esc_html__( 'Editar Familias', 'text-domain' ),
- 'view_item' => esc_html__( 'Ver Familia', 'text-domain' ),
- 'update_item' => esc_html__( 'Actualizar Familia', 'text-domain' ),
- 'add_new_item' => esc_html__( 'Agregar Nueva Familia', 'text-domain' ),
- 'new_item_name' => esc_html__( 'Nueva Familia', 'text-domain' ),
- 'parent_item' => esc_html__( 'Familia Padre', 'text-domain' ),
- 'parent_item_colon' => esc_html__( 'Familia Padre:', 'text-domain' ),
- 'search_items' => esc_html__( 'Buscar Familias', 'text-domain' ),
- 'popular_items' => esc_html__( 'Familias populares', 'text-domain' ),
- 'separate_items_with_commas' => esc_html__( 'Familias separadas con comas', 'text-domain' ),
- 'add_or_remove_items' => esc_html__( 'Agregar o Eliminar Familias', 'text-domain' ),
- 'choose_from_most_used' => esc_html__( 'Elegir desde las Familias más usadas', 'text-domain' ),
- 'not_found' => esc_html__( 'No se encontraron Familias', 'text-domain' ),
- 'name' => esc_html__( 'Familias', 'text-domain' ),
- 'singular_name' => esc_html__( 'Familia', 'text-domain' ),
- ),
- 'public' => true,
- 'show_ui' => true,
- 'show_in_menu' => true,
- 'show_in_nav_menus' => true,
- 'show_tagcloud' => true,
- 'show_in_quick_edit' => true,
- 'show_admin_column' => true,
- 'show_in_rest' => true,
- 'hierarchical' => true,
- 'query_var' => true,
- 'sort' => false,
- 'rewrite_no_front' => false,
- 'rewrite_hierarchical' => false,
- 'rewrite' => true,
- );
- register_taxonomy( 'familia', array( 'accesorio' ), $args );
- }
- add_action( 'init', 'your_prefix_register_taxonomy5', 0 );
- add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes6' );
- function your_prefix_register_meta_boxes6( $meta_boxes ) {
- $prefix = '';
- $meta_boxes[] = array (
- 'title' => esc_html__( 'Accesorios detalle', 'text-domain' ),
- 'id' => 'accesorios-detalle',
- 'post_types' => array(
- 0 => 'accesorio',
- ),
- 'context' => 'normal',
- 'priority' => 'high',
- 'fields' => array(
- array (
- 'id' => $prefix . 'ac_image_accesorios',
- 'type' => 'single_image',
- 'name' => esc_html__( 'Imagen accesorios', 'text-domain' ),
- ),
- array (
- 'id' => $prefix . 'ac_precio_real',
- 'type' => 'number',
- 'name' => esc_html__( 'Precio accesorio', 'text-domain' ),
- ),
- array (
- 'id' => $prefix . 'ac_list_carac',
- 'type' => 'textarea',
- 'name' => esc_html__( 'Lista de características', 'text-domain' ),
- ),
- ),
- );
- return $meta_boxes;
- }
- add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes7' );
- function your_prefix_register_meta_boxes7( $meta_boxes ) {
- $prefix = '';
- $meta_boxes[] = array (
- 'title' => esc_html__( 'Vehículos - Configuración', 'text-domain' ),
- 'id' => 'vehiculos-configuracion',
- 'post_types' => array(
- 0 => 'vehiculo',
- ),
- 'context' => 'normal',
- 'priority' => 'high',
- 'fields' => array(
- array (
- 'id' => $prefix . 'if_vehiculos_imagen2',
- 'type' => 'single_image',
- 'name' => esc_html__( 'Imagen principal', 'text-domain' ),
- 'tab' => 'if_vehiculos_tab_general',
- ),
- array (
- 'id' => $prefix . 'if_vehiculos_familia',
- 'type' => 'text',
- 'name' => esc_html__( 'Familia', 'text-domain' ),
- 'tab' => 'if_vehiculos_tab_general',
- ),
- array (
- 'id' => $prefix . 'if_vehiculos_slider',
- 'type' => 'text',
- 'name' => esc_html__( 'Slider', 'text-domain' ),
- 'desc' => esc_html__( 'Escriba el Shortcode que arroja el revolution Slider', 'text-domain' ),
- 'tab' => 'if_vehiculos_tab_general',
- ),
- array (
- 'id' => $prefix . 'if_vehiculos_accesorios',
- 'type' => 'taxonomy',
- 'name' => esc_html__( 'Familia de accesorios', 'text-domain' ),
- 'taxonomy' => 'familia',
- 'field_type' => 'select',
- 'tab' => 'if_vehiculos_tab_general',
- ),
- array (
- 'id' => $prefix . 'if_vehiculos_ficha_tecnica_general',
- 'type' => 'file_input',
- 'name' => esc_html__( 'Ficha técnica general', 'text-domain' ),
- 'tab' => 'if_vehiculos_tab_general',
- ),
- array (
- 'id' => $prefix . 'heading_33yatm363gp',
- 'type' => 'heading',
- 'name' => esc_html__( 'PESTAÑA 1', 'text-domain' ),
- 'tab' => 'if_vehiculos_tab_pestanas',
- ),
- array (
- 'id' => $prefix . 'if_vehiculos_tab1_img',
- 'type' => 'single_image',
- 'name' => esc_html__( 'Imagen Pestaña 1', 'text-domain' ),
- 'columns' => 4,
- 'tab' => 'if_vehiculos_tab_pestanas',
- ),
- array (
- 'id' => $prefix . 'if_vehiculos_tab1_nombre',
- 'type' => 'text',
- 'name' => esc_html__( 'Nombre Pestaña 1', 'text-domain' ),
- 'columns' => 4,
- 'tab' => 'if_vehiculos_tab_pestanas',
- ),
- array (
- 'id' => $prefix . 'if_vehiculos_tab1_url',
- 'type' => 'text',
- 'name' => esc_html__( 'Url Pestaña 1', 'text-domain' ),
- 'columns' => 4,
- 'tab' => 'if_vehiculos_tab_pestanas',
- ),
- array (
- 'id' => $prefix . 'heading_33yatm363gp_8mhjetp7gxv',
- 'type' => 'heading',
- 'name' => esc_html__( 'PESTAÑA 2', 'text-domain' ),
- 'tab' => 'if_vehiculos_tab_pestanas',
- ),
- array (
- 'id' => $prefix . 'if_vehiculos_tab2_img',
- 'type' => 'single_image',
- 'name' => esc_html__( 'Imagen Pestaña 2', 'text-domain' ),
- 'columns' => 4,
- 'tab' => 'if_vehiculos_tab_pestanas',
- ),
- array (
- 'id' => $prefix . 'if_vehiculos_tab2_nombre',
- 'type' => 'text',
- 'name' => esc_html__( 'Nombre Pestaña 2', 'text-domain' ),
- 'columns' => 4,
- 'tab' => 'if_vehiculos_tab_pestanas',
- ),
- array (
- 'id' => $prefix . 'if_vehiculos_tab2_url',
- 'type' => 'text',
- 'name' => esc_html__( 'Url Pestaña 2', 'text-domain' ),
- 'columns' => 4,
- 'tab' => 'if_vehiculos_tab_pestanas',
- ),
- array (
- 'id' => $prefix . 'heading_33yatm363gp_8mhjetp7gxv_b8bcc4wuxrh',
- 'type' => 'heading',
- 'name' => esc_html__( 'PESTAÑA 3', 'text-domain' ),
- 'tab' => 'if_vehiculos_tab_pestanas',
- ),
- array (
- 'id' => $prefix . 'if_vehiculos_tab3_img',
- 'type' => 'single_image',
- 'name' => esc_html__( 'Imagen Pestaña 3', 'text-domain' ),
- 'columns' => 4,
- 'tab' => 'if_vehiculos_tab_pestanas',
- ),
- array (
- 'id' => $prefix . 'if_vehiculos_tab3_nombre',
- 'type' => 'text',
- 'name' => esc_html__( 'Nombre Pestaña 3', 'text-domain' ),
- 'columns' => 4,
- 'tab' => 'if_vehiculos_tab_pestanas',
- ),
- array (
- 'id' => $prefix . 'if_vehiculos_tab3_url',
- 'type' => 'text',
- 'name' => esc_html__( 'Url Pestaña 3', 'text-domain' ),
- 'columns' => 4,
- 'tab' => 'if_vehiculos_tab_pestanas',
- ),
- array (
- 'id' => $prefix . 'heading_33yatm363gp_8mhjetp7gxv_b8bcc4wuxrh_r0iklnxjvw',
- 'type' => 'heading',
- 'name' => esc_html__( 'PESTAÑA 4', 'text-domain' ),
- 'tab' => 'if_vehiculos_tab_pestanas',
- ),
- array (
- 'id' => $prefix . 'if_vehiculos_tab4_img',
- 'type' => 'single_image',
- 'name' => esc_html__( 'Imagen Pestaña 4', 'text-domain' ),
- 'columns' => 4,
- 'tab' => 'if_vehiculos_tab_pestanas',
- ),
- array (
- 'id' => $prefix . 'if_vehiculos_tab4_nombre',
- 'type' => 'text',
- 'name' => esc_html__( 'Nombre Pestaña 4', 'text-domain' ),
- 'columns' => 4,
- 'tab' => 'if_vehiculos_tab_pestanas',
- ),
- array (
- 'id' => $prefix . 'if_vehiculos_tab4_url',
- 'type' => 'text',
- 'name' => esc_html__( 'Url Pestaña 4', 'text-domain' ),
- 'columns' => 4,
- 'tab' => 'if_vehiculos_tab_pestanas',
- ),
- ),
- 'tab_style' => 'left',
- 'tab_wrapper' => true,
- 'tabs' => array(
- 'if_vehiculos_tab_general' => array(
- 'label' => 'General',
- 'icon' => 'dashicons-admin-generic',
- ),
- 'if_vehiculos_tab_pestanas' => array(
- 'label' => 'Pestañas',
- 'icon' => 'dashicons-portfolio',
- ),
- ),
- );
- return $meta_boxes;
- }
- //add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' );
- // function your_prefix_register_meta_boxes( $meta_boxes ) {
- // $prefix = '';
- // $meta_boxes[] = array (
- // 'title' => esc_html__( 'Select Form', 'text-domain' ),
- // 'id' => 'select-form',
- // 'post_types' => array(
- // 0 => 'post',
- // ),
- // 'context' => 'normal',
- // 'priority' => 'high',
- // 'fields' => array(
- // array (
- // 'id' => $prefix . 'Versione_select',
- // 'type' => 'Versione_select',
- // 'name' => esc_html__( 'Select Form', 'text-domain' ),
- // ),
- // ),
- // );
- // return $meta_boxes;
- // }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement