1

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

At the moment, this is not possible.

Just create your own custom settings page and place your options to it.

More details and examples: https://blog.templatetoaster.com/wordpress-settings-api-creating-theme-options/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.