Display tab based on the value of a field within another tab

Support MB Tabs Display tab based on the value of a field within another tabResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #16299
    ComSiComSi
    Participant

    Hi Anh,

    Were using 3 tabs and like to display only two. But when we choose one of the radio buttons in the first tab we like to display the 3 tab. Is this possible?

    We tried this, but with no result:

    $meta_boxes[] = [
        'id'          => '...',
        'title'       => '...',
        'post_types'  => '...',
        'context'     => 'normal',
        'priority'    => 'high',
        'tab_style'   => 'box',
        'tab_wrapper' => false,
        'tabs'        => [
            'details' => [
                'label' => 'Details',
                'icon'  => 'dashicons-admin-generic',
            ],
            'location' => [
                'label' => 'Location',
                'icon'  => 'dashicons-location-alt',
            ],
            'recurring' => [
                'label'   => 'Recurring',
                'icon'    => 'dashicons-update',
                'visible' => [ 'duration_frequency', '=', 'recurring'],
            ],
        ]
    ]
    

    The field on which it should display or not:

    
    [
        'tab'     => 'details',
        'id'      => 'duration_frequency',
        'name'    => 'Event duration',
        'type'    => 'button_group',
        'options' => [
            'single'    => 'Single day',
            'multiple'  => 'Multi day',
            'recurring' => 'Recurring'
        ]
    ]
    
    #16306
    Anh TranAnh Tran
    Keymaster

    Hi,

    It's impossible with the current version. I think that can be done with custom code via custom_callback (see the docs), but I haven't tested yet.

    #16324
    ComSiComSi
    Participant

    Yeah that's kind of what we were expecting, but wanted to make sure.
    We'll try the custom_callback, thanks for that tip.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.