标签

选项卡允许您使用 Container 方法 .add_tab() 在不同的选项卡面板下对多个字段进行分组

选项卡可用于每种Container类型。 例子:

use Carbon_Fields\Container;
use Carbon_Fields\Field;

Container::make( 'post_meta', __( 'User Settings' ) )
    ->where( 'post_type', '=', 'page' )
    ->add_tab( __( 'Profile' ), array(
        Field::make( 'text', 'crb_first_name', __( 'First Name' ) ),
        Field::make( 'text', 'crb_last_name', __( 'Last Name' ) ),
        Field::make( 'text', 'crb_position', __( 'Position' ) ),
    ) )
    ->add_tab( __( 'Notification' ), array(
        Field::make( 'text', 'crb_email', __( 'Notification Email' ) ),
        Field::make( 'text', 'crb_phone', __( 'Phone Number' ) ),
    ) );