+// Certain error codes are less fatal than others. We can still display theme information in most cases.
+if ( ! $ct->errors() || ( 1 == count( $ct->errors()->get_error_codes() )
+ && in_array( $ct->errors()->get_error_code(), array( 'theme_no_parent', 'theme_parent_invalid', 'theme_no_index' ) ) ) ) : ?>
+
+ <div>
+ <ul class="theme-info">
+ <li><?php printf( __('By %s'), $ct->display('Author') ); ?></li>
+ <li><?php printf( __('Version %s'), $ct->display('Version') ); ?></li>
+ </ul>
+ <p class="theme-description"><?php echo $ct->display('Description'); ?></p>
+ <?php if ( $ct->parent() ) {
+ printf( ' <p class="howto">' . __( 'This <a href="%1$s">child theme</a> requires its parent theme, %2$s.' ) . '</p>',
+ __( 'http://codex.wordpress.org/Child_Themes' ),
+ $ct->parent()->display( 'Name' ) );
+ } ?>
+ <?php theme_update_available( $ct ); ?>
+ </div>
+
+ <?php
+ // Pretend you didn't see this.
+ $options = array();
+ if ( is_array( $submenu ) && isset( $submenu['themes.php'] ) ) {
+ foreach ( (array) $submenu['themes.php'] as $item) {
+ $class = '';
+ if ( 'themes.php' == $item[2] || 'theme-editor.php' == $item[2] || 'customize.php' == $item[2] )
+ continue;
+ // 0 = name, 1 = capability, 2 = file
+ if ( ( strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file)) )
+ $class = ' class="current"';
+ if ( !empty($submenu[$item[2]]) ) {
+ $submenu[$item[2]] = array_values($submenu[$item[2]]); // Re-index.
+ $menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
+ if ( file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
+ $options[] = "<a href='admin.php?page={$submenu[$item[2]][0][2]}'$class>{$item[0]}</a>";
+ else
+ $options[] = "<a href='{$submenu[$item[2]][0][2]}'$class>{$item[0]}</a>";
+ } else if ( current_user_can($item[1]) ) {
+ $menu_file = $item[2];
+ if ( false !== ( $pos = strpos( $menu_file, '?' ) ) )
+ $menu_file = substr( $menu_file, 0, $pos );
+ if ( file_exists( ABSPATH . "wp-admin/$menu_file" ) ) {
+ $options[] = "<a href='{$item[2]}'$class>{$item[0]}</a>";
+ } else {
+ $options[] = "<a href='themes.php?page={$item[2]}'$class>{$item[0]}</a>";
+ }
+ }
+ }
+ }
+
+ if ( $options || current_user_can( 'edit_theme_options' ) ) :
+ ?>
+ <div class="theme-options">
+ <?php if ( current_user_can( 'edit_theme_options' ) ) : ?>
+ <a id="customize-current-theme-link" href="<?php echo wp_customize_url(); ?>" class="load-customize hide-if-no-customize" title="<?php echo esc_attr( $customize_title ); ?>"><?php _e( 'Customize' ); ?></a>
+ <?php
+ endif; // edit_theme_options
+ if ( $options ) :
+ ?>
+ <span><?php _e( 'Options:' )?></span>
+ <ul>
+ <?php foreach ( $options as $option ) : ?>
+ <li><?php echo $option; ?></li>
+ <?php endforeach; ?>
+ </ul>
+ <?php
+ endif; // options
+ ?>
+ </div>
+ <?php
+ endif; // options || edit_theme_options
+ ?>
+
+<?php endif; // theme errors ?>
+
+</div>
+
+<br class="clear" />