_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

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: