Skip to content

Instantly share code, notes, and snippets.

@thebigtine
Created September 9, 2016 15:26
Show Gist options
  • Save thebigtine/cca0833fb29ea2a9ee887c2fa094062d to your computer and use it in GitHub Desktop.
Save thebigtine/cca0833fb29ea2a9ee887c2fa094062d to your computer and use it in GitHub Desktop.
add_filter('admin_init', 'msf_general_settings_register_fields');
function msf_general_settings_register_fields()
{
register_setting('general', 'homepage_image', 'esc_attr');
add_settings_field('homepage_image', '<label for="homepage_image">'.__('Homepage Header Image' , 'homepage_image' ).'</label>' , 'msf_general_settings_fields_html', 'general');
}
function msf_general_settings_fields_html()
{
$value = get_option( 'homepage_image', '' );
echo '<input class="regular-text" type="url" id="homepage_image" name="homepage_image" value="' . $value . '" />';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment