Advertisements

do_settings_sections

Definition:
function do_settings_sections($page) {}

Prints out all settings sections added to a particular settings page
Part of the Settings API. Use this in a settings page callback function to output all the sections and fields that were added to that $page with add_settings_section() and add_settings_field()

Parameters

  • string $page: The slug name of the page whos settings sections you want to output

Source code

function do_settings_sections($page) {

	global $wp_settings_sections, $wp_settings_fields;



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

		return;



	foreach ( (array) $wp_settings_sections[$page] as $section ) {

		echo "<h3>{$section['title']}</h3>\n";

		call_user_func($section['callback'], $section);

		if ( !isset($wp_settings_fields) || !isset($wp_settings_fields[$page]) || !isset($wp_settings_fields[$page][$section['id']]) )

			continue;

		echo '<table class="form-table">';

		do_settings_fields($page, $section['id']);

		echo '</table>';

	}

972

Advertisements

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 )

Google+ photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s

%d bloggers like this: