Advertisements

do_settings_fields

Definition:
function do_settings_fields($page, $section) {}

Print out the settings fields for a particular settings section
Part of the Settings API. Use this in a settings page to output a specific section. Should normally be called by do_settings_sections() rather than directly.

Parameters

  • string $page: Slug title of the admin page who’s settings fields you want to show.
  • section $section: Slug title of the settings section who’s fields you want to show.

Source code

function do_settings_fields($page, $section) {

	global $wp_settings_fields;



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

		return;



	foreach ( (array) $wp_settings_fields[$page][$section] as $field ) {

		echo '<tr valign="top">';

		if ( !empty($field['args']['label_for']) )

			echo '<th scope="row"><label for="' . $field['args']['label_for'] . '">' . $field['title'] . '</label></th>';

		else

			echo '<th scope="row">' . $field['title'] . '</th>';

		echo '<td>';

		call_user_func($field['callback'], $field['args']);

		echo '</td>';

		echo '</tr>';

	}

}

970

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: