• I can’t find a more or less clear example on how to create additional fields, so may be someone can help me here? Here is my code:

    function __construct(){
        add_action('admin_init', array($this, 'plugin_admin_init'));
    }
    
    public function create_fields(){
        register_setting('dleToWp_options', 'database_name');
        register_setting('dleToWp_options', 'database_prefix');
        register_setting('dleToWp_options', 'version');
        //Stuck here
        // add_settings_section('dleToWp_options', __('Settings', 'dleToWp'), NULL, 'dleToWp');
        // add_settings_field('plugin_text_string', 'Plugin Text Input', 'plugin_setting_string', 'plugin', 'dleToWp');
    }
    
    public function settings_page(){
    
        echo '<div class="wrap">
            <div class="icon32" id="icon-tools"></div>
            <h2>'.__('Database converter', 'dleToWp').'</h2>
            <form action="options.php" method="post">';
        settings_fields('dleToWp_options');
        do_settings_sections('dleToWp');
        echo '</form></div>';
    }

    I nee create 3 fields: Database name, database prefix and select box of versions.

  • The topic ‘How to add options to the plugin page?’ is closed to new replies.