$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', 'seo_title', 'esc_attr' );
add_settings_field('fav_color', '<label for="seo_title">'.__('SEO Tagline' , 'seo_title' ).'</label>' , array(&$this, 'fields_html') , 'general' );
}
function fields_html() {
$value = get_option( 'seo_title', '' );
echo '<input type="text" id="seo_title" name="seo_title" value="' . $value . '" />';
}
}
From: http://trepmal.com/2011/03/07/add-field-to-general-settings-page/
To output the new setting in a template, you can use get_option(), like this:
<?php $seo_title_value = get_option( 'seo_title', '' ); echo $seo_title_value; ?>
To output the new setting in a template, you can use get_option(), like this:
<?php $seo_title_value = get_option( 'seo_title', '' ); echo $seo_title_value; ?>
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.