Add Field to General Settings Page in Wordpress
$new_general_setting = new new_general_setting();
class new_general_setting {
function new_general_setting( ) {
add_filter( 'admin_init' , array( &$this , 'register_fields' ) );
}
function register_fields() {
register_setting( 'general', 'profile_message', 'esc_attr' );
add_settings_field('prof_message', '<label for="prof_message">'.__('Profile Share Message?' , 'profile_message' ).'</label>' , array(&$this, 'fields_html') , 'general' );
}
function fields_html() {
$value = get_option( 'prof_message', '' );
echo '<textarea id="prof_message" cols="100" rows="3" name="profile_message">' . $value . '</textarea>';
}
}
post it in your functions.php file. and you can get the values anywhere by using
$message_Profile = get_option( 'profile_message', '' );
Thanks!
class new_general_setting {
function new_general_setting( ) {
add_filter( 'admin_init' , array( &$this , 'register_fields' ) );
}
function register_fields() {
register_setting( 'general', 'profile_message', 'esc_attr' );
add_settings_field('prof_message', '<label for="prof_message">'.__('Profile Share Message?' , 'profile_message' ).'</label>' , array(&$this, 'fields_html') , 'general' );
}
function fields_html() {
$value = get_option( 'prof_message', '' );
echo '<textarea id="prof_message" cols="100" rows="3" name="profile_message">' . $value . '</textarea>';
}
}
post it in your functions.php file. and you can get the values anywhere by using
$message_Profile = get_option( 'profile_message', '' );
Thanks!