2 require_once('admin.php');
4 if ( isset($_GET['action']) ) {
5 check_admin_referer('switch-theme_' . $_GET['template']);
7 if ('activate' == $_GET['action']) {
8 switch_theme($_GET['template'], $_GET['stylesheet']);
9 wp_redirect('themes.php?activated=true');
14 $title = __('Manage Themes');
15 $parent_file = 'themes.php';
16 require_once('admin-header.php');
19 <?php if ( ! validate_current_theme() ) : ?>
20 <div id="message1" class="updated fade"><p><?php _e('The active theme is broken. Reverting to the default theme.'); ?></p></div>
21 <?php elseif ( isset($_GET['activated']) ) : ?>
22 <div id="message2" class="updated fade"><p><?php printf(__('New theme activated. <a href="%s">Visit site</a>'), get_bloginfo('url') . '/'); ?></p></div>
26 $themes = get_themes();
27 $ct = current_theme_info();
31 <h2><?php _e('Current Theme'); ?></h2>
32 <div id="currenttheme">
33 <?php if ( $ct->screenshot ) : ?>
34 <img src="<?php echo get_option('siteurl') . '/' . $ct->stylesheet_dir . '/' . $ct->screenshot; ?>" alt="<?php _e('Current theme preview'); ?>" />
36 <h3><?php printf(_c('%1$s %2$s by %3$s|1: theme title, 2: theme version, 3: theme author'), $ct->title, $ct->version, $ct->author) ; ?></h3>
37 <p><?php echo $ct->description; ?></p>
38 <?php if ($ct->parent_theme) { ?>
39 <p><?php printf(__('The template files are located in <code>%2$s</code>. The stylesheet files are located in <code>%3$s</code>. <strong>%4$s</strong> uses templates from <strong>%5$s</strong>. Changes made to the templates will affect both themes.'), $ct->title, $ct->template_dir, $ct->stylesheet_dir, $ct->title, $ct->parent_theme); ?></p>
41 <p><?php printf(__('All of this theme’s files are located in <code>%2$s</code>.'), $ct->title, $ct->template_dir, $ct->stylesheet_dir); ?></p>
43 <?php if ( $ct->tags ) : ?>
44 <p><?php _e('Tags:'); ?> <?php echo join(', ', $ct->tags); ?></p>
48 <h2><?php _e('Available Themes'); ?></h2>
49 <?php if ( 1 < count($themes) ) { ?>
54 $theme_names = array_keys($themes);
55 natcasesort($theme_names);
57 foreach ($theme_names as $theme_name) {
58 if ( $theme_name == $ct->name )
60 $template = $themes[$theme_name]['Template'];
61 $stylesheet = $themes[$theme_name]['Stylesheet'];
62 $title = $themes[$theme_name]['Title'];
63 $version = $themes[$theme_name]['Version'];
64 $description = $themes[$theme_name]['Description'];
65 $author = $themes[$theme_name]['Author'];
66 $screenshot = $themes[$theme_name]['Screenshot'];
67 $stylesheet_dir = $themes[$theme_name]['Stylesheet Dir'];
68 $tags = $themes[$theme_name]['Tags'];
69 $activate_link = wp_nonce_url("themes.php?action=activate&template=".urlencode($template)."&stylesheet=".urlencode($stylesheet), 'switch-theme_' . $template);
71 <div class="available-theme">
72 <h3><a href="<?php echo $activate_link; ?>"><?php echo $title; ?></a></h3>
74 <a href="<?php echo $activate_link; ?>" class="screenshot">
75 <?php if ( $screenshot ) : ?>
76 <img src="<?php echo get_option('siteurl') . '/' . $stylesheet_dir . '/' . $screenshot; ?>" alt="" />
80 <p><?php echo $description; ?></p>
81 <?php if ( $tags ) : ?>
82 <p><?php _e('Tags:'); ?> <?php echo join(', ', $tags); ?></p>
85 <?php } // end foreach theme_names ?>
90 // List broken themes, if any.
91 $broken_themes = get_broken_themes();
92 if ( count($broken_themes) ) {
95 <h2><?php _e('Broken Themes'); ?></h2>
96 <p><?php _e('The following themes are installed but incomplete. Themes must have a stylesheet and a template.'); ?></p>
98 <table width="100%" cellpadding="3" cellspacing="3">
100 <th><?php _e('Name'); ?></th>
101 <th><?php _e('Description'); ?></th>
106 $theme_names = array_keys($broken_themes);
107 natcasesort($theme_names);
109 foreach ($theme_names as $theme_name) {
110 $title = $broken_themes[$theme_name]['Title'];
111 $description = $broken_themes[$theme_name]['Description'];
113 $theme = ('class="alternate"' == $theme) ? '' : 'class="alternate"';
117 <td>$description</td>
126 <h2><?php _e('Get More Themes'); ?></h2>
127 <p><?php _e('You can find additional themes for your site in the <a href="http://wordpress.org/extend/themes/">WordPress theme directory</a>. To install a theme you generally just need to upload the theme folder into your <code>wp-content/themes</code> directory. Once a theme is uploaded, you should see it on this page.'); ?></p>
131 <?php require('admin-footer.php'); ?>