WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WP_Theme_Install_List_Table::single_row() public WP 3.1.0

Prints a theme from the WordPress.org API.

Это метод класса: WP_Theme_Install_List_Table{}

Хуки из метода
Возвращает

Null. Ничего.

Использование

$WP_Theme_Install_List_Table = new WP_Theme_Install_List_Table();
$WP_Theme_Install_List_Table->single_row( $theme );
$theme(объект) (обязательный)

An object that contains theme data returned by the WordPress.org API.

  • name(строка)
    Theme name, e.g. 'Twenty Twenty'.

  • slug(строка)
    Theme slug, e.g. 'twentytwenty'.

  • version(строка)
    Theme version, e.g. '1.1'.

  • author(строка)
    Theme author username, e.g. 'melchoyce'.

  • preview_url(строка)
    Preview URL, e.g. 'https://2020.wordpress.net/'.

  • screenshot_url(строка)
    Screenshot URL, e.g. 'https://wordpress.org/themes/twentytwenty/'.

  • rating(float)
    Rating score.

  • num_ratings(число)
    The number of ratings.

  • homepage(строка)
    Theme homepage, e.g. 'https://wordpress.org/themes/twentytwenty/'.

  • description(строка)
    Theme description.

  • download_link(строка)
    Theme ZIP download URL.

Заметки

  • Global. Массив. $themes_allowedtags

Список изменений

С версии 3.1.0 Введена.

Код WP_Theme_Install_List_Table::single_row() WP 5.5.1

wp-admin/includes/class-wp-theme-install-list-table.php
<?php
public function single_row( $theme ) {
	global $themes_allowedtags;

	if ( empty( $theme ) ) {
		return;
	}

	$name   = wp_kses( $theme->name, $themes_allowedtags );
	$author = wp_kses( $theme->author, $themes_allowedtags );

	/* translators: %s: Theme name. */
	$preview_title = sprintf( __( 'Preview &#8220;%s&#8221;' ), $name );
	$preview_url   = add_query_arg(
		array(
			'tab'   => 'theme-information',
			'theme' => $theme->slug,
		),
		self_admin_url( 'theme-install.php' )
	);

	$actions = array();

	$install_url = add_query_arg(
		array(
			'action' => 'install-theme',
			'theme'  => $theme->slug,
		),
		self_admin_url( 'update.php' )
	);

	$update_url = add_query_arg(
		array(
			'action' => 'upgrade-theme',
			'theme'  => $theme->slug,
		),
		self_admin_url( 'update.php' )
	);

	$status = $this->_get_theme_status( $theme );

	switch ( $status ) {
		case 'update_available':
			$actions[] = sprintf(
				'<a class="install-now" href="%s" title="%s">%s</a>',
				esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ),
				/* translators: %s: Theme version. */
				esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ),
				__( 'Update' )
			);
			break;
		case 'newer_installed':
		case 'latest_installed':
			$actions[] = sprintf(
				'<span class="install-now" title="%s">%s</span>',
				esc_attr__( 'This theme is already installed and is up to date' ),
				_x( 'Installed', 'theme' )
			);
			break;
		case 'install':
		default:
			$actions[] = sprintf(
				'<a class="install-now" href="%s" title="%s">%s</a>',
				esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ),
				/* translators: %s: Theme name. */
				esc_attr( sprintf( _x( 'Install %s', 'theme' ), $name ) ),
				__( 'Install Now' )
			);
			break;
	}

	$actions[] = sprintf(
		'<a class="install-theme-preview" href="%s" title="%s">%s</a>',
		esc_url( $preview_url ),
		/* translators: %s: Theme name. */
		esc_attr( sprintf( __( 'Preview %s' ), $name ) ),
		__( 'Preview' )
	);

	/**
	 * Filters the install action links for a theme in the Install Themes list table.
	 *
	 * @since 3.4.0
	 *
	 * @param string[] $actions An array of theme action links. Defaults are
	 *                          links to Install Now, Preview, and Details.
	 * @param WP_Theme $theme   Theme object.
	 */
	$actions = apply_filters( 'theme_install_actions', $actions, $theme );

	?>
	<a class="screenshot install-theme-preview" href="<?php echo esc_url( $preview_url ); ?>" title="<?php echo esc_attr( $preview_title ); ?>">
		<img src="<?php echo esc_url( $theme->screenshot_url ); ?>" width="150" alt="" />
	</a>

	<h3><?php echo $name; ?></h3>
	<div class="theme-author">
	<?php
		/* translators: %s: Theme author. */
		printf( __( 'By %s' ), $author );
	?>
	</div>

	<div class="action-links">
		<ul>
			<?php foreach ( $actions as $action ) : ?>
				<li><?php echo $action; ?></li>
			<?php endforeach; ?>
			<li class="hide-if-no-js"><a href="#" class="theme-detail"><?php _e( 'Details' ); ?></a></li>
		</ul>
	</div>

	<?php
	$this->install_theme_info( $theme );
}