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.

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
scroll top