How to add more tabs
K15Lmk98 opened this issue · 4 comments
K15Lmk98 commented
This is an automatic translation.
Hello,
what code should i use to add more tabs?
Thank you, Claudio_
taunoha commented
You can use the cmb2_theme_options_tab_tabs hook to do that.
For example:
function cmb2_theme_options_tab_tabs_callback($tabs)
{
return array(
'global' => array(
'translated_name' => 'Global',
'language_code' => 'global'
),
'global2' => array(
'translated_name' => 'Global2',
'language_code' => 'global2'
)
);
}
add_filter('cmb2_theme_options_tab_tabs', 'cmb2_theme_options_tab_tabs_callback');
I assume that you aren't using WPML plugin?
K15Lmk98 commented
Thank you Taunoha for the answer.
I do not use Wpml.
I understand how to create the second "global2" tab.
Now how to assign the fields only to the second "global2" tab?
Claudio
taunoha commented
There is a 'show_in_tab' option in field defination that you can use.
array(
'name' => 'Facebook URL',
'id' => 'facebook_url',
'type' => 'text_url',
'show_in_tab' => 'en' // <- language_Code
)
K15Lmk98 commented
Thank you Taunoha.
Claudio_