WP_MS_Themes_List_Table::single_row_columns( WP_Theme $item )

Handles the output for a single table row.


Parameters

$item WP_Theme Required
The current WP_Theme object.

Top ↑

Source

File: wp-admin/includes/class-wp-ms-themes-list-table.php. View all references

public function single_row_columns( $item ) {
	list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();

	foreach ( $columns as $column_name => $column_display_name ) {
		$extra_classes = '';
		if ( in_array( $column_name, $hidden, true ) ) {
			$extra_classes .= ' hidden';
		}

		switch ( $column_name ) {
			case 'cb':
				echo '<th scope="row" class="check-column">';

				$this->column_cb( $item );

				echo '</th>';
				break;

			case 'name':
				$active_theme_label = '';

				/* The presence of the site_id property means that this is a subsite view and a label for the active theme needs to be added */
				if ( ! empty( $this->site_id ) ) {
					$stylesheet = get_blog_option( $this->site_id, 'stylesheet' );
					$template   = get_blog_option( $this->site_id, 'template' );

					/* Add a label for the active template */
					if ( $item->get_template() === $template ) {
						$active_theme_label = ' &mdash; ' . __( 'Active Theme' );
					}

					/* In case this is a child theme, label it properly */
					if ( $stylesheet !== $template && $item->get_stylesheet() === $stylesheet ) {
						$active_theme_label = ' &mdash; ' . __( 'Active Child Theme' );
					}
				}

				echo "<td class='theme-title column-primary{$extra_classes}'><strong>" . $item->display( 'Name' ) . $active_theme_label . '</strong>';

				$this->column_name( $item );

				echo '</td>';
				break;

			case 'description':
				echo "<td class='column-description desc{$extra_classes}'>";

				$this->column_description( $item );

				echo '</td>';
				break;

			case 'auto-updates':
				echo "<td class='column-auto-updates{$extra_classes}'>";

				$this->column_autoupdates( $item );

				echo '</td>';
				break;
			default:
				echo "<td class='$column_name column-$column_name{$extra_classes}'>";

				$this->column_default( $item, $column_name );

				echo '</td>';
				break;
		}
	}
}


Top ↑

Changelog

Changelog
Version Description
4.3.0 Introduced.

Top ↑

User Contributed Notes

You must log in before being able to contribute a note or feedback.