Skip to content

Instantly share code, notes, and snippets.

@schalkjoubert
Last active October 6, 2017 04:38
Show Gist options
  • Save schalkjoubert/587b80af6545cf7640985c572fad50a3 to your computer and use it in GitHub Desktop.
Save schalkjoubert/587b80af6545cf7640985c572fad50a3 to your computer and use it in GitHub Desktop.
Custom Post Type Archive Description Field
//http://wpsettingsapi.jeroensormani.com/
add_action( 'admin_menu', 'tsumtour_add_admin_menu' );
add_action( 'admin_init', 'tsumtour_settings_init' );
function tsumtour_add_admin_menu( ) {
add_submenu_page( 'edit.php?post_type=tour', 'Tour', 'Intro', 'manage_options', 'tour', 'tsumtour_options_page' );
}
function tsumtour_settings_init( ) {
register_setting( 'pluginPage', 'tsumtour_settings' );
add_settings_section(
'tsumtour_pluginPage_section',
__( 'Introduction', 'tsum_tour' ),
'tsumtour_settings_section_callback',
'pluginPage'
);
add_settings_field(
'tsumtour_textarea_field_0',
__( '', 'tsum_tour' ),
'tsumtour_textarea_field_0_render',
'pluginPage',
'tsumtour_pluginPage_section'
);
}
function tsumtour_textarea_field_0_render( ) {
$options = get_option( 'tsumtour_settings' );
?>
<textarea cols='80' rows='15' name='tsumtour_settings[tsumtour_textarea_field_0]'>
<?php echo $options['tsumtour_textarea_field_0']; ?>
</textarea>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment