Theme tagging from andy. fixes #5545

git-svn-id: https://develop.svn.wordpress.org/trunk@6530 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2007-12-31 18:39:43 +00:00
parent d9cfccddc1
commit 00db74c820
5 changed files with 17 additions and 2 deletions

View File

@ -14,6 +14,7 @@ function current_theme_info() {
$ct->screenshot = $themes[$current_theme]['Screenshot'];
$ct->description = $themes[$current_theme]['Description'];
$ct->author = $themes[$current_theme]['Author'];
$ct->tags = $themes[$current_theme]['Tags'];
return $ct;
}

View File

@ -40,6 +40,9 @@ $ct = current_theme_info();
<?php } else { ?>
<p><?php printf(__('All of this theme&#8217;s files are located in <code>%2$s</code>.'), $ct->title, $ct->template_dir, $ct->stylesheet_dir); ?></p>
<?php } ?>
<?php if ( $ct->tags ) : ?>
<p><?php _e('Tags:'); ?> <?php echo join(', ', $ct->tags); ?></p>
<?php endif; ?>
</div>
<h2><?php _e('Available Themes'); ?></h2>
@ -62,6 +65,7 @@ foreach ($theme_names as $theme_name) {
$author = $themes[$theme_name]['Author'];
$screenshot = $themes[$theme_name]['Screenshot'];
$stylesheet_dir = $themes[$theme_name]['Stylesheet Dir'];
$tags = $themes[$theme_name]['Tags'];
$activate_link = wp_nonce_url("themes.php?action=activate&amp;template=".urlencode($template)."&amp;stylesheet=".urlencode($stylesheet), 'switch-theme_' . $template);
?>
<div class="available-theme">
@ -74,6 +78,9 @@ foreach ($theme_names as $theme_name) {
</a>
<p><?php echo $description; ?></p>
<?php if ( $tags ) : ?>
<p><?php _e('Tags:'); ?> <?php echo join(', ', $tags); ?></p>
<?php endif; ?>
</div>
<?php } // end foreach theme_names ?>

View File

@ -4,6 +4,7 @@ Theme URI: http://wordpress.org/
Description: The original WordPress theme that graced versions 1.2.x and prior.
Version: 1.5
Author: Dave Shea
Tags: mantle color, variable width, two columns, widgets
Default WordPress by Dave Shea || http://mezzoblue.com
Modifications by Matthew Mullenweg || http://photomatt.net

View File

@ -5,6 +5,7 @@ Description: The default WordPress theme based on the famous <a href="http://bin
Version: 1.6
Author: Michael Heilemann
Author URI: http://binarybonsai.com/
Tags: blue, custom header, fixed width, two columns, widgets
Kubrick v1.5
http://binarybonsai.com/kubrick/

View File

@ -90,6 +90,11 @@ function get_theme_data( $theme_file ) {
else
$status = 'publish';
if ( preg_match('|Tags:(.*)|i', $theme_data, $tags) )
$tags = array_map( 'trim', explode( ',', wp_kses( trim( $tags[1] ), array() ) ) );
else
$tags = array();
$name = $theme = wp_kses( trim( $theme_name[1] ), $themes_allowed_tags );
$theme_uri = clean_url( trim( $theme_uri[1] ) );
$description = wptexturize( wp_kses( trim( $description[1] ), $themes_allowed_tags ) );
@ -103,7 +108,7 @@ function get_theme_data( $theme_file ) {
$author = sprintf( '<a href="%1$s" title="%2$s">%3$s</a>', $author_uri, __( 'Visit author homepage' ), wp_kses( trim( $author_name[1] ), $themes_allowed_tags ) );
}
return array( 'Name' => $name, 'Title' => $theme, 'URI' => $theme_uri, 'Description' => $description, 'Author' => $author, 'Version' => $version, 'Template' => $template, 'Status' => $status );
return array( 'Name' => $name, 'Title' => $theme, 'URI' => $theme_uri, 'Description' => $description, 'Author' => $author, 'Version' => $version, 'Template' => $template, 'Status' => $status, 'Tags' => $tags );
}
function get_themes() {
@ -261,7 +266,7 @@ function get_themes() {
}
}
$themes[$name] = array('Name' => $name, 'Title' => $title, 'Description' => $description, 'Author' => $author, 'Version' => $version, 'Template' => $template, 'Stylesheet' => $stylesheet, 'Template Files' => $template_files, 'Stylesheet Files' => $stylesheet_files, 'Template Dir' => $template_dir, 'Stylesheet Dir' => $stylesheet_dir, 'Status' => $theme_data['Status'], 'Screenshot' => $screenshot);
$themes[$name] = array('Name' => $name, 'Title' => $title, 'Description' => $description, 'Author' => $author, 'Version' => $version, 'Template' => $template, 'Stylesheet' => $stylesheet, 'Template Files' => $template_files, 'Stylesheet Files' => $stylesheet_files, 'Template Dir' => $template_dir, 'Stylesheet Dir' => $stylesheet_dir, 'Status' => $theme_data['Status'], 'Screenshot' => $screenshot, 'Tags' => $theme_data['Tags']);
}
// Resolve theme dependencies.