-
Notifications
You must be signed in to change notification settings - Fork 8
Tab
Tabs allow you to group the fields in your container and only show the fields, which belong to the current tab.
In the interface, tabs are treated like any other field. Just select "Tab" as the field type and adjust the tabs' settings. In PHP the behavior is similar. You have to create a new field of the tab
type and add it to the standard flow.
All fields, added after the tab will be assigned to it, until a new tab is found.
$container->add_fields(array(
Field::create( 'tab', 'first_tab' ),
Field::create( 'text', 'first_tab_field' ),
Field::create( 'tab', 'seconc_tab' ),
Field::create( 'text', 'second_tab_field' ),
));
You can use the Dashicons icon font in order to add icons to tabs.
In PHP you need to use the set_icon
method of the tab and provide it with the CSS class of the icon.
Field::create( 'tab', 'appearance' )
->set_icon( 'dashicons-art' )
Tabs, as well as any other field, support conditional logic.
When a tab has conditional rules added to it, those rules affect not only the tab, but also the fields, contained within that tab. When there are no valid matches for the logic behind a tab, it will be grayed-out (disabled) and will not be clickable. The fields within a tab will also not be validated if the tab is not active.
Quick start
- Creating fields and using their values
- Installation
- Administration interface
- Using the PHP API
- Container Settings
Locations
- Overview & Usage
- Post Type
- Options Page
- Taxonomy
- Comment
- User
- Widget
- Shortcode
- Menu Item
- Attachment
- Customizer
Fields
- Fields
- Text
- Textarea
- WYSIWYG
- Password
- Checkbox
- Select
- Multiselect
- Image Select
- File
- Image
- Audio
- Video
- Gallery
- WP Object
- WP Objects
- Link
- Date
- DateTime
- Time
- Color
- Font
- Icon
- Map
- Embed
- Number
- Sidebar
- Complex
- Repeater
- Layout
- Section
- Tab
- Message
Features
- Adding fields to the Customizer
- Conditional Logic
- Front-End Forms
- Administration columns
- Import and Export
- REST API
- JSON Synchronization
- Yoast SEO
Ultimate Post Types
Functions and API
Tutorials