Custom Fields
Re-Envisioned
Support Meta Box Tabs Display tab based on the value of a field within another tab

  • Creator
    Topic
  • #16299
    Resolved ComSi
    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'
        ]
    ]
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #16306
    Anh 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
    ComSi
    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 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.