Advertisements

do_meta_boxes

Definition:
function do_meta_boxes($page, $context, $object) {}

Meta-Box template function

Parameters

  • string|object $screen: Screen identifier
  • string $context: box context
  • mixed $object: gets passed to the box callback function as first parameter

Return values

returns:number of meta_boxes

Source code

function do_meta_boxes($page, $context, $object) {

	global $wp_meta_boxes;

	static $already_sorted = false;



	$hidden = get_hidden_meta_boxes($page);



	printf('<div id="%s-sortables" class="meta-box-sortables">', htmlspecialchars($context));



	$i = 0;

	do {

		// Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose

		if ( !$already_sorted && $sorted = get_user_option( "meta-box-order_$page" ) ) {

			foreach ( $sorted as $box_context => $ids ) {

				foreach ( explode(',', $ids ) as $id ) {

					if ( $id && 'dashboard_browser_nag' !== $id )

						add_meta_box( $id, null, null, $page, $box_context, 'sorted' );

				}

			}

		}

		$already_sorted = true;



		if ( !isset($wp_meta_boxes) || !isset($wp_meta_boxes[$page]) || !isset($wp_meta_boxes[$page][$context]) )

			break;



		foreach ( array('high', 'sorted', 'core', 'default', 'low') as $priority ) {

			if ( isset($wp_meta_boxes[$page][$context][$priority]) ) {

				foreach ( (array) $wp_meta_boxes[$page][$context][$priority] as $box ) {

					if ( false == $box || ! $box['title'] )

						continue;

					$i++;

					$style = '';

					$hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : '';

					echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";

					if ( 'dashboard_browser_nag' != $box['id'] )

						echo '<div class="handlediv" title="' . esc_attr__('Click to toggle') . '"><br /></div>';

					echo "<h3 class='hndle'><span>{$box['title']}</span></h3>\n";

					echo '<div class="inside">' . "\n";

					call_user_func($box['callback'], $object, $box);

					echo "</div>\n";

					echo "</div>\n";

				}

			}

		}

	} while(0);

966

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: