Separate fields array with container in theme options ( Carbon Fields )

435 Views Asked by At

Is it possible to separate those two add_fields() and wrap each other in container with a title so they look nicer in theme options?

add_action( 'carbon_fields_register_fields', 'crb_attach_theme_options' );
function crb_attach_theme_options() {
    Container::make( 'theme_options', __( 'Theme Options' ) )
        ->add_fields(array(
            Field::make('text', 'tel_nmbr', 'Telephone number'),
            Field::make('text', 'whatsapp_nmbr', 'WhatsApp number'),
            Field::make('text', 'viber_nmbr', 'WhatsApp number'),
            Field::make('text', 'telegram_nmbr', 'Telegram number'),
        ))
        ->add_fields(array(
            Field::make('textarea', 'ga_field', 'Google Analytics code')
                ->set_rows(4),
            Field::make('textarea', 'banners_field', 'Banners code')
                ->set_rows(4)
        ));
}

enter image description here

1

There are 1 best solutions below

0
On

Found it! just have to put the field "Separator" in between.

Field::make( 'separator', 'crb_separator', __( 'Social' ) )