Question

Using add_settings_field(); i am able to add my custom setting:

add_settings_field('AUTOPLAY', 'Auto Play', 'printAutoPlayCheckbox', 'my_settings');


function printAutoPlayCheckbox()
{
   $id = 'AUTOPLAY';
   $name = 'my_settings' . "[$id]";
   $options = get_option('my_settings');
   echo '<input type="checkbox" id="' . $id . '" name="' . $name . '" ' . checked(1, isset($options[$id]), false) . '" />';
}

enter image description here

Now i want to add a short description of this setting, something like that:

enter image description here

How can i do that? I couldn't find it in the WordPress docs.

Était-ce utile?

La solution

I've not seen this type of title settings layout in the admin pages, so it seems you're parting away from it.

Otherwise note that the title field of add_settings_field() is unescaped, so in theory one could add some HTML code for new title layout.

Usually the description is added to the input field.

Licencié sous: CC-BY-SA avec attribution
Non affilié à wordpress.stackexchange
scroll top