you can try a code like this
<?php
function theme_settings_init(){
register_setting( 'theme_settings', 'theme_settings' );
}
î This is used to reserve a name for a custom settings array
//Add settings to page menu
function add_settings_page() {
add_menu_page( __( 'Contenu éditable' ), __( 'Contenu éditable' ), 'manage_options', 'settings', 'theme_settings_page');
}
î This will create the page in the admin
//Add Actions
add_action( 'admin_init', 'theme_settings_init' );
add_action( 'admin_menu', 'add_settings_page' );
î WordPress hooking
//Start Setting Page
function theme_settings_page() {?>
<div>
<div id="icon-options-general"></div>
<h2 id="title"><?php _e( 'Contenu éditable' ) //your admin panel title ?></h2>
<?php if($_GET['settings-updated'] == true): ?>
<div id="message" class="updated below-h2"><p>Saved successfully</p></div>
<?php endif; ?>
<form method="post" action="options.php">
<?php settings_fields( 'theme_settings' ); ?>
<?php $options = get_option( 'theme_settings' );
$defaults = array(
'viadeo' => 'http://www.viadeo.com',
'linkedin' => 'http://www.linkedin.com',
);
?>
<table>
<tr valign="top">
<th scope="row"><?php _e( 'Lien viadeo' ); ?></th>
<td><input id="theme_settings[viadeo]" type="text" size="40" name="theme_settings[viadeo]" value="<?php (!empty($options['viadeo']))?esc_attr_e( $options['viadeo'] ):esc_attr_e($defaults['viadeo']); ?>" />
<?php if(empty($options['viadeo'])):?>
Please hit the save button in ordrer to save the default values
<?php endif; ?>
</td>
</tr>
<tr valign="top">
<th scope="row"><?php _e( 'Lien Linkedin' ); ?></th>
<td><input id="theme_settings[linkedin]" type="text" size="40" name="theme_settings[linkedin]" value="<?php (!empty($options['linkedin']))?esc_attr_e( $options['linkedin'] ):esc_attr_e($defaults['linkedin']); ?>" />
<?php if(empty($options['linkedin'])):?>
Please hit the save button in ordrer to save the default values
<?php endif; ?>
</td>
</tr>
</table>
<p><input name="submit" id="submit" class="button button-primary" value="Save Changes" type="submit"></p>
</form>
</div>
<?php
}
î This is the code that will display your page
//validation
function options_validate( $input ) {
global $select_options, $radio_options;
if ( ! isset( $input['option1'] ) )
$input['option1'] = null;
$input['option1'] = ( $input['option1'] == 1 ? 1 : 0 );
$input['sometext'] = wp_filter_nohtml_kses( $input['sometext'] );
if ( ! isset( $input['radioinput'] ) )
$input['radioinput'] = null;
if ( ! array_key_exists( $input['radioinput'], $radio_options ) )
$input['radioinput'] = null;
$input['sometextarea'] = wp_filter_post_kses( $input['sometextarea'] );
return $input;
}
?>
Finally the code above will save the values of you fields.
You can add this code at the bottom of your functions.php or create a new file (better solution, more readable) and require it in your functions.php
Enjoy