add_settings_section

Definition:
function add_settings_section($id, $title, $callback, $page) {}

Add a new section to a settings page.
Part of the Settings API. Use this to define new settings sections for an admin page. Show settings sections in your admin page callback function with do_settings_sections(). Add settings fields to your section with add_settings_field()

Parameters

  • string $id: Slug-name to identify the section. Used in the ‘id’ attribute of tags.
  • string $title: Formatted title of the section. Shown as the heading for the section.
  • string $callback: Function that echos out any content at the top of the section (between heading and fields).
  • string $page: The slug-name of the settings page on which to show the section. Built-in pages include ‘general’, ‘reading’, ‘writing’, ‘discussion’, ‘media’, etc. Create your own using add_options_page();

Source code

function add_settings_section($id, $title, $callback, $page) {

	global $wp_settings_sections;



	if ( 'misc' == $page ) {

		_deprecated_argument( __FUNCTION__, '3.0', __( 'The miscellaneous options group has been removed. Use another settings group.' ) );

		$page = 'general';

	}



	if ( !isset($wp_settings_sections) )

		$wp_settings_sections = array();

	if ( !isset($wp_settings_sections[$page]) )

		$wp_settings_sections[$page] = array();

	if ( !isset($wp_settings_sections[$page][$id]) )

		$wp_settings_sections[$page][$id] = array();



	$wp_settings_sections[$page][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback);

}

301

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: