Customize format of settings

Question

I am adding some settings to the “General” settings page:

add_settings_section(
    'foobar_settings_section',
    'Foobar Options',
    [$this, 'foobar_options_callback'],
    'general'
);

$fields = [
    'foobar_title' => 'Title',
    'foobar_link' => 'Link',
    // lots more
];

foreach ($fields as $fieldKey => $fieldTitle) {
    add_settings_field(
        $fieldKey,
        $fieldTitle,
        [$this, 'foobar_textbox_callback'],
        'general',
        'foobar_settings_section',
        [$fieldKey]
    );

    register_setting('general', $fieldKey, 'esc_attr');
}

This just outputs a column of many input fields, which functionally is fine. But it makes for confusing UX. Is there a way to generally make this section prettier? E.g. to divide it into subsections, or into columns?

0
GluePear 3 years 2020-04-01T08:52:21-05:00 0 Answers 57 views 0

Leave an answer

Browse
Browse