How to Use Checkbox in Custom Option Page Using The Setting API

Can you please let me know how I can add a checkbox to Setting API in creating Custom Options Page? I am using the following code to add a txt box which is working perfectly but I am totally confused how to add chechbox to the setting API and options. I just tried ti update the input type to checkbox but I am not sure what to put in Value besides when I save the form the check box still appears unchecked!

 add_settings_field('the_option_label',
                    'Display Paragraph:',
                     array($this,'the_option_label_setting'),
                     __FILE__,
                     'hte_main_section');

 public function the_option_label_setting()
    {
       echo "<input name='My_Theme_Options[the_option_label]' type='text' value='{$this->options['the_option_label']}'/>";
    }

Thanks

Answers 0

Related Questions