_print_scripts

Definition:
function _print_scripts() {}

Source code

function _print_scripts() {

	global $wp_scripts, $compress_scripts;



	$zip = $compress_scripts ? 1 : 0;

	if ( $zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP )

		$zip = 'gzip';



	if ( !empty($wp_scripts->concat) ) {



		if ( !empty($wp_scripts->print_code) ) {

			echo "\n<script type='text/javascript'>\n";

			echo "/* <![CDATA[ */\n"; // not needed in HTML 5

			echo $wp_scripts->print_code;

			echo "/* ]]> */\n";

			echo "</script>\n";

		}



		$ver = md5("$wp_scripts->concat_version");

		$src = $wp_scripts->base_url . "/wp-admin/load-scripts.php?c={$zip}&load=" . trim($wp_scripts->concat, ', ') . "&ver=$ver";

		echo "<script type='text/javascript' src='" . esc_attr($src) . "'></script>\n";

	}

4359

_post_states

Definition:
function _post_states($post) {}

Parameters

  • $post

Defined filters

  • display_post_states
    apply_filters( 'display_post_states', $post_states )

Source code

function _post_states($post) {

	$post_states = array();

	if ( isset($_GET['post_status']) )

		$post_status = $_GET['post_status'];

	else

		$post_status = '';



	if ( !empty($post->post_password) )

		$post_states['protected'] = __('Password protected');

	if ( 'private' == $post->post_status && 'private' != $post_status )

		$post_states['private'] = __('Private');

	if ( 'draft' == $post->post_status && 'draft' != $post_status )

		$post_states['draft'] = __('Draft');

	if ( 'pending' == $post->post_status && 'pending' != $post_status )

		/* translators: post state */

		$post_states['pending'] = _x('Pending', 'post state');

	if ( is_sticky($post->ID) )

		$post_states['sticky'] = __('Sticky');



	$post_states = apply_filters( 'display_post_states', $post_states );



	if ( ! empty($post_states) ) {

		$state_count = count($post_states);

		$i = 0;

		echo ' - ';

		foreach ( $post_states as $state ) {

			++$i;

			( $i == $state_count ) ? $sep = '' : $sep = ', ';

			echo "<span class='post-state'>$state$sep</span>";

		}

	}



	if ( get_post_format( $post->ID ) )

		echo ' - <span class="post-state-format">' . get_post_format_string( get_post_format( $post->ID ) ) . '</span>';

}

4357

_page_traverse_name

Definition:
function _page_traverse_name( $page_id, &$children, &$result ){

function to traverse and return all the nested children post names of a root page.
$children contains parent-children relations

Parameters

  • $page_id
  • &$children
  • &$result

Source code

function _page_traverse_name( $page_id, &$children, &$result ){

	if ( isset( $children[ $page_id ] ) ){

		foreach( (array)$children[ $page_id ] as $child ) {

			$result[ $child->ID ] = $child->post_name;

			_page_traverse_name( $child->ID, $children, $result );

		}

	}

}

4353

_page_rows

Definition:
function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page ) {}

Given a top level page ID, display the nested hierarchy of sub-pages together with paging support

Parameters

  • unknown_type $children_pages
  • unknown_type $count
  • unknown_type $parent
  • unknown_type $level
  • unknown_type $pagenum
  • unknown_type $per_page
  • &$children_pages
  • &$count

Source code

function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page ) {



	if ( ! isset( $children_pages[$parent] ) )

		return;



	$start = ($pagenum - 1) * $per_page;

	$end = $start + $per_page;



	foreach ( $children_pages[$parent] as $page ) {



		if ( $count >= $end )

			break;



		// If the page starts in a subtree, print the parents.

		if ( $count == $start && $page->post_parent > 0 ) {

			$my_parents = array();

			$my_parent = $page->post_parent;

			while ( $my_parent) {

				$my_parent = get_post($my_parent);

				$my_parents[] = $my_parent;

				if ( !$my_parent->post_parent )

					break;

				$my_parent = $my_parent->post_parent;

			}

			$num_parents = count($my_parents);

			while( $my_parent = array_pop($my_parents) ) {

				echo "\t" . display_page_row( $my_parent, $level - $num_parents );

				$num_parents--;

			}

		}



		if ( $count >= $start )

			echo "\t" . display_page_row( $page, $level );



		$count++;



		_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );

	}



	unset( $children_pages[$parent] ); //required in order to keep track of orphans

}

4351