display_theme

Definition:
function display_theme($theme, $actions = null, $show_details = true) {}

Parameters

  • $theme
  • $actions
  • $show_details

Defined filters

  • theme_install_action_links
    apply_filters('theme_install_action_links', $actions, $theme)

Source code

function display_theme($theme, $actions = null, $show_details = true) {

	global $themes_allowedtags;



	if ( empty($theme) )

		return;



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

	$desc = wp_kses($theme->description, $themes_allowedtags);

	//if ( strlen($desc) > 30 )

	//	$desc =  substr($desc, 0, 15) . '<span class="dots">...</span><span>' . substr($desc, -15) . '</span>';



	$preview_link = $theme->preview_url . '?TB_iframe=true&amp;width=600&amp;height=400';

	if ( !is_array($actions) ) {

		$actions = array();

		$actions[] = '<a href="' . self_admin_url('theme-install.php?tab=theme-information&amp;theme=' . $theme->slug .

										'&amp;TB_iframe=true&amp;tbWidth=500&amp;tbHeight=385') . '" class="thickbox thickbox-preview onclick" title="' . esc_attr(sprintf(__('Install “%s”'), $name)) . '">' . __('Install') . '</a>';

		if ( !is_network_admin() )

			$actions[] = '<a href="' . $preview_link . '" class="thickbox thickbox-preview onclick previewlink" title="' . esc_attr(sprintf(__('Preview “%s”'), $name)) . '">' . __('Preview') . '</a>';

		$actions = apply_filters('theme_install_action_links', $actions, $theme);

	}



	$actions = implode ( ' | ', $actions );

	?>

<a class='thickbox thickbox-preview screenshot'

	href='<?php echo esc_url($preview_link); ?>'

	title='<?php echo esc_attr(sprintf(__('Preview “%s”'), $name)); ?>'>

<img src='<?php echo esc_url($theme->screenshot_url); ?>' width='150' />

</a>

<h3><?php echo $name ?></h3>

<span class='action-links'><?php echo $actions ?></span>

<p><?php echo $desc ?></p>

<?php if ( $show_details ) { ?>

<a href="#theme_detail" class="theme-detail hide-if-no-js" tabindex='4'><?php _e('Details') ?></a>

<div class="themedetaildiv hide-if-js">

<p><strong><?php _e('Version:') ?></strong> <?php echo wp_kses($theme->version, $themes_allowedtags) ?></p>

<p><strong><?php _e('Author:') ?></strong> <?php echo wp_kses($theme->author, $themes_allowedtags) ?></p>

<?php if ( ! empty($theme->last_updated) ) : ?>

<p><strong><?php _e('Last Updated:') ?></strong> <span title="<?php echo $theme->last_updated ?>"><?php printf( __('%s ago'), human_time_diff(strtotime($theme->last_updated)) ) ?></span></p>

<?php endif; if ( ! empty($theme->requires) ) : ?>

<p><strong><?php _e('Requires WordPress Version:') ?></strong> <?php printf(__('%s or higher'), $theme->requires) ?></p>

<?php endif; if ( ! empty($theme->tested) ) : ?>

<p><strong><?php _e('Compatible up to:') ?></strong> <?php echo $theme->tested ?></p>

<?php endif; if ( !empty($theme->downloaded) ) : ?>

<p><strong><?php _e('Downloaded:') ?></strong> <?php printf(_n('%s time', '%s times', $theme->downloaded), number_format_i18n($theme->downloaded)) ?></p>

<?php endif; ?>

<div class="star-holder" title="<?php printf(_n('(based on %s rating)', '(based on %s ratings)', $theme->num_ratings), number_format_i18n($theme->num_ratings)) ?>">

	<div class="star star-rating" style="width: <?php echo esc_attr($theme->rating) ?>px"></div>

	<div class="star star5"><img src="<?php echo admin_url('images/star.png?v=20110615'); ?>" alt="<?php _e('5 stars') ?>" /></div>

	<div class="star star4"><img src="<?php echo admin_url('images/star.png?v=20110615'); ?>" alt="<?php _e('4 stars') ?>" /></div>

	<div class="star star3"><img src="<?php echo admin_url('images/star.png?v=20110615'); ?>" alt="<?php _e('3 stars') ?>" /></div>

	<div class="star star2"><img src="<?php echo admin_url('images/star.png?v=20110615'); ?>" alt="<?php _e('2 stars') ?>" /></div>

	<div class="star star1"><img src="<?php echo admin_url('images/star.png?v=20110615'); ?>" alt="<?php _e('1 star') ?>" /></div>

</div>

</div>

<?php }

	/*

	 object(stdClass)[59]

	 public 'name' => string 'Magazine Basic' (length=14)

	 public 'slug' => string 'magazine-basic' (length=14)

	 public 'version' => string '1.1' (length=3)

	 public 'author' => string 'tinkerpriest' (length=12)

	 public 'preview_url' => string 'http://wp-themes.com/?magazine-basic' (length=36)

	 public 'screenshot_url' => string 'http://wp-themes.com/wp-content/themes/magazine-basic/screenshot.png' (length=68)

	 public 'rating' => float 80

	 public 'num_ratings' => int 1

	 public 'homepage' => string 'http://wordpress.org/extend/themes/magazine-basic' (length=49)

	 public 'description' => string 'A basic magazine style layout with a fully customizable layout through a backend interface. Designed by <a href="http://bavotasan.com">c.bavota</a> of <a href="http://tinkerpriestmedia.com">Tinker Priest Media</a>.' (length=214)

	 public 'download_link' => string 'http://wordpress.org/extend/themes/download/magazine-basic.1.1.zip' (length=66)

	 */

}

930

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 )

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: