Custom Fields
Re-Envisioned
Support Meta Box Tabs Input Fields at top of section when using tabs

  • Creator
    Topic
  • #19091
    Resolved carassius
    Participant

    For some reason, when I use Tabs, I get an input field for each tab

    null

    This is my function

    
    function wcd_blocklayout_register_meta_boxes( $meta_boxes ) {
        $prefix = 'wcd-blocklayout-';
    
        $meta_boxes[] = array (
            'title' => esc_html__( 'Block Layouts', 'wcd' ),
            'id' => 'wcd-block-layouts',
            'post_types' => array(
                0 => 'wcd_blocklayout',
            ),
            'context' => 'after_title',
            'priority' => 'high',
            'fields' => array(
                array (
                    'id' => $prefix . '',
                ),
                array (
                    'id' => $prefix . 'block',
                    'name' => esc_html__( 'Block', 'wcd' ),
                    'type' => 'select',
                    'placeholder' => esc_html__( 'Select an Item', 'wcd' ),
                    'clone' => 1,
                    'add_button' => esc_html__( 'Add another block', 'wcd' ),
                    'tab' => 'settings-tab',
                ),
                array (
                    'id' => $prefix . '',
                ),
                array (
                    'id' => $prefix . 'post_type',
                    'name' => esc_html__( 'Post Type', 'wcd' ),
                    'type' => 'select',
                    'placeholder' => esc_html__( 'Select an Item', 'wcd' ),
                    'options' => array(
                        'posts' => esc_html__( 'posts', 'wcd' ),
                        'pages' => esc_html__( 'pages', 'wcd' ),
                    ),
                    'clone' => 1,
                    'required' => 1,
                    'add_button' => esc_html__( 'Add Location Rule', 'wcd' ),
                    'tab' => 'display-tab',
                ),
                array (
                    'id' => $prefix . 'exclude',
                    'name' => esc_html__( 'Exclude Post Type', 'wcd' ),
                    'type' => 'select',
                    'placeholder' => esc_html__( 'Select an Item', 'wcd' ),
                    'options' => array(
                        'posts' => esc_html__( 'posts', 'wcd' ),
                        'pages' => esc_html__( 'pages', 'wcd' ),
                    ),
                    'clone' => 1,
                    'add_button' => esc_html__( 'Add Exclusion Rule', 'wcd' ),
                    'tab' => 'display-tab',
                ),
                array (
                    'id' => $prefix . '',
                ),
                array (
                    'id' => $prefix . 'notes',
                    'type' => 'textarea',
                    'name' => esc_html__( 'Internal Notes', 'wcd' ),
                    'tab' => 'notes-tab',
                ),
            ),
            'tab_style' => 'default',
            'tab_wrapper' => true,
            'text_domain' => 'wcd',
            'tabs' => array(
                'settings-tab' => array(
                    'label' => 'Settings',
                    'icon' => 'dashicons-admin-generic',
                ),
                'display-tab' => array(
                    'label' => 'Display Rules',
                    'icon' => 'dashicons-admin-tools',
                ),
                'notes-tab' => array(
                    'label' => 'Internal Notes',
                    'icon' => 'dashicons-edit',
                ),
            ),
        );
    
        return $meta_boxes;
    }
    add_filter( 'rwmb_meta_boxes', 'wcd_blocklayout_register_meta_boxes' );
    
Viewing 6 replies - 1 through 6 (of 6 total)
  • Author
    Replies
  • #19096
    Long Nguyen
    Moderator

    Hi,

    Please remove the code (three times)

    array (
        'id' => $prefix . '',
    ),

    which renders input fields, see my screenshot https://cl.ly/b9a30d9456eb

    #19169
    carassius
    Participant

    Thanks, so that is the builder that output the code for me, so there must be a bug in the builder

    #19173
    Long Nguyen
    Moderator

    Hi,

    I’ve tested on my site but cannot replicate this issue. Could you please take a screen record when building the tabs with MB Builder? And please make sure the Tab field must be added first or stay on the top of list fields, see this screenshot https://cl.ly/567689ec5a0e

    #19177
    carassius
    Participant

    Here is a exported dat file of one I just created

    #19178
    carassius
    Participant

    I realise I cannot use tabs in groups either, which sucks as I was hoping to seperate content from style for each slide

    #19183
    Long Nguyen
    Moderator

    Hi,

    You can use the tab and group as well but when using the Builder, the field tab must be added first. Please see my screen record https://www.loom.com/share/894e1842c81c4f56aaa1d84b75d2bf99

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
grid gear info copy caret-up caret-down trash