_term_rows

Definition:
function _term_rows( $taxonomy, $terms, &$children, $page = 1, $per_page = 20, &$count, $parent = 0, $level = 0 ) {}

Parameters

  • $taxonomy
  • $terms
  • &$children
  • $page
  • $per_page
  • &$count
  • $parent
  • $level

Source code

function _term_rows( $taxonomy, $terms, &$children, $page = 1, $per_page = 20, &$count, $parent = 0, $level = 0 ) {



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

	$end = $start + $per_page;



	$output = '';

	foreach ( $terms as $key => $term ) {



		if ( $count >= $end )

			break;



		if ( $term->parent != $parent && empty($_GET['s']) )

			continue;



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

		if ( $count == $start && $term->parent > 0 && empty($_GET['s']) ) {

			$my_parents = $parent_ids = array();

			$p = $term->parent;

			while ( $p ) {

				$my_parent = get_term( $p, $taxonomy );

				$my_parents[] = $my_parent;

				$p = $my_parent->parent;

				if ( in_array($p, $parent_ids) ) // Prevent parent loops.

					break;

				$parent_ids[] = $p;

			}

			unset($parent_ids);



			$num_parents = count($my_parents);

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

				$output .=  "\t" . _tag_row( $my_parent, $level - $num_parents, $taxonomy );

				$num_parents--;

			}

		}



		if ( $count >= $start )

			$output .= "\t" . _tag_row( $term, $level, $taxonomy );



		++$count;



		unset($terms[$key]);



		if ( isset($children[$term->term_id]) && empty($_GET['s']) )

			$output .= _term_rows( $taxonomy, $terms, $children, $page, $per_page, $count, $term->term_id, $level + 1 );

	}



	return $output;

}

4379

_tag_row

Definition:
function _tag_row( $tag, $level, $taxonomy = 'post_tag' ) {}

Parameters

  • unknown_type $tag
  • unknown_type $class
  • $level
  • $taxonomy

Defined filters

  • term_name
    apply_filters( 'term_name', $pad . ' ' . $tag->name, $tag )
  • tag_row_actions
    apply_filters('tag_row_actions', $actions, $tag)
  • ${taxonomy}_row_actions
    apply_filters("${taxonomy}_row_actions", $actions, $tag)
  • editable_slug
    apply_filters('editable_slug', $qe_data->slug)
  • editable_slug
    apply_filters('editable_slug', $tag->slug)
  • manage_${taxonomy}_custom_column
    apply_filters("manage_${taxonomy}_custom_column", '', $column_name, $tag->term_id)

Source code

function _tag_row( $tag, $level, $taxonomy = 'post_tag' ) {

		global $post_type, $current_screen;

		static $row_class = '';

		$row_class = ($row_class == '' ? ' class="alternate"' : '');



		$count = number_format_i18n( $tag->count );

		$tax = get_taxonomy($taxonomy);



		if ( 'post_tag' == $taxonomy ) {

			$tagsel = 'tag';

		} elseif ( 'category' == $taxonomy ) {

			$tagsel = 'category_name';

		} elseif ( ! empty($tax->query_var) ) {

			$tagsel = $tax->query_var;

		} else {

			$tagsel = $taxonomy;

		}



		$pad = str_repeat( '— ', max(0, $level) );

		$name = apply_filters( 'term_name', $pad . ' ' . $tag->name, $tag );

		$qe_data = get_term($tag->term_id, $taxonomy, object, 'edit');

		$edit_link = "edit-tags.php?action=edit&taxonomy=$taxonomy&post_type=$post_type&tag_ID=$tag->term_id";



		$out = '';

		$out .= '<tr id="tag-' . $tag->term_id . '"' . $row_class . '>';





		$columns = get_column_headers($current_screen);

		$hidden = get_hidden_columns($current_screen);

		$default_term = get_option('default_' . $taxonomy);

		foreach ( $columns as $column_name => $column_display_name ) {

			$class = "class=\"$column_name column-$column_name\"";



			$style = '';

			if ( in_array($column_name, $hidden) )

				$style = ' style="display:none;"';



			$attributes = "$class$style";



			switch ($column_name) {

				case 'cb':

					if ( current_user_can($tax->cap->delete_terms) && $tag->term_id != $default_term )

						$out .= '<th scope="row" class="check-column"> <input type="checkbox" name="delete_tags[]" value="' . $tag->term_id . '" /></th>';

					else

						$out .= '<th scope="row" class="check-column">&nbsp;</th>';

					break;

				case 'name':

					$out .= '<td ' . $attributes . '><strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr(sprintf(__('Edit “%s”'), $name)) . '">' . $name . '</a></strong><br />';

					$actions = array();

					if ( current_user_can($tax->cap->edit_terms) ) {

						$actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';

						$actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';

					}

					if ( current_user_can($tax->cap->delete_terms) && $tag->term_id != $default_term )

						$actions['delete'] = "<a class='delete-tag' href='" . wp_nonce_url("edit-tags.php?action=delete&amp;taxonomy=$taxonomy&amp;tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id) . "'>" . __('Delete') . "</a>";



					$actions = apply_filters('tag_row_actions', $actions, $tag);

					$actions = apply_filters("${taxonomy}_row_actions", $actions, $tag);



					$action_count = count($actions);

					$i = 0;

					$out .= '<div class="row-actions">';

					foreach ( $actions as $action => $link ) {

						++$i;

						( $i == $action_count ) ? $sep = '' : $sep = ' | ';

						$out .= "<span class='$action'>$link$sep</span>";

					}

					$out .= '</div>';

					$out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';

					$out .= '<div class="name">' . $qe_data->name . '</div>';

					$out .= '<div class="slug">' . apply_filters('editable_slug', $qe_data->slug) . '</div>';

					$out .= '<div class="parent">' . $qe_data->parent . '</div></div></td>';

					break;

				case 'description':

					$out .= "<td $attributes>$tag->description</td>";

					break;

				case 'slug':

					$out .= "<td $attributes>" . apply_filters('editable_slug', $tag->slug) . "</td>";

					break;

				case 'posts':

					$attributes = 'class="posts column-posts num"' . $style;

					$out .= "<td $attributes><a href='edit.php?$tagsel=$tag->slug&amp;post_type=$post_type'>$count</a></td>";

					break;

				default:

					$out .= "<td $attributes>";

					$out .= apply_filters("manage_${taxonomy}_custom_column", '', $column_name, $tag->term_id);

					$out .= "</td>";

			}

4377

_show_post_preview

Definition:
function _show_post_preview() {}

Source code

function _show_post_preview() {



	if ( isset($_GET['preview_id']) && isset($_GET['preview_nonce']) ) {

		$id = (int) $_GET['preview_id'];



		if ( false == wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . $id ) )

			wp_die( __('You do not have permission to preview drafts.') );



		add_filter('the_preview', '_set_preview');

	}

}

4375

_set_preview

Definition:
function _set_preview($post) {}

Parameters

  • $post

Source code

function _set_preview($post) {



	if ( ! is_object($post) )

		return $post;



	$preview = wp_get_post_autosave($post->ID);



	if ( ! is_object($preview) )

		return $post;



	$preview = sanitize_post($preview);



	$post->post_content = $preview->post_content;

	$post->post_title = $preview->post_title;

	$post->post_excerpt = $preview->post_excerpt;



	return $post;

}

4373

_search_terms_tidy

Definition:
function _search_terms_tidy($t) {}

Parameters

  • $t

Source code

function _search_terms_tidy($t) {

	return trim($t, "\"'\n\r ");

}

4371