add_settings_field Data not passing to Options Page Like it should

I am creating an options page with some fields. As you can see from the code below, I only have one field registered. However, when I try to send that field to my options page, it does not display the field. I cannot seem to find out what I am doing wrong. Any help would be greatly appreciated.

Thanks

 <?php

 class WH_Options{

public function _construct()
{
    $this->register_settings_and_fields();
}

public function add_menu_page()
{
    add_menu_page('Portable OP', 'Portable OP', 'administrator', __FILE__, array(WH_Options, 'display_options_page'));
}

public function display_options_page()
{
     ?>
    <div class="wrap">
        <div id="icon-options-general" class="icon32"><br></div>
        <h2>Portable Theme Options</h2>
        <form method="post" action="options.php" enctype="multipart/form-data">
            <?php settings_fields('wh_plugin_options'); ?>
            <?php do_settings_sections(__FILE__); ?>
        </form>

    </div>
    <?php
}

public function register_settings_and_fields()
{
    register_setting('wh_plugin_options', 'wh_plugin_options' ); // 3rd paramater is a call back function
    add_settings_section('wh_main_section', 'Main Settings', array($this,'wh_main_section_cb'), __FILE__ ); // id, title of section, cb, which page
    add_settings_field('wh_banner_heading', 'Banner Heading', array($this,'wh_banner_heading_setting'), __FILE__, 'wh_main_section' );
}

public function wh_main_section_cb()
{

}

    /*
    The inputs
    */

    // Banner Heading
    public function wh_banner_heading_setting()
   {
     echo "<input />";
   }

}

 add_action('admin_menu', function(){
    WH_Options::add_menu_page();
});

add_action('admin_init', function(){
  new WH_Options();
 });
 ?>

Related posts

Leave a Reply