Adding Tabs - rogerlos/cmb2-metatabs-options GitHub Wiki
Tabs can be added to CMO either by injecting an array into the class (see the "Quick Example"), or by adding them directly within the add_tabs()
method.
Assuming a $tabs
array, each new tab is configured like so:
$tabs[] = array(
'id' => 'your_tab_id',
'title' => 'Your Tab Title',
'desc' => '<p>Optional HTML to display above the metaboxes on this tab.</p>',
'boxes' => array(
'cmb2_metabox_id',
'another_cmb2_metabox_id',
'etc',
),
);
The plain "boxes" array within the configuration contains your metabox ids.
Some caveats when using tabs:
- Any metaboxes not assigned to a tab and not in the sidebar (on a two-column page) will be hidden by default. In other words, using tabs presumes all metaboxes will be assigned to a tab.
- Tabs can only be used in the "main" column of a two-column page.
- A metabox assigned to multiple tabs will only be shown in one of them.
Tabs are rendered in the order you configure them, and the metaboxes within them are shown in the order you give them in the boxes
array.
Note that CMO uses javascript to move metaboxes to their proper tab after the page is output. This may be result in a short delay depending on the complexity of your page.