WordPress.org

Making WordPress.org


Ignore:
Timestamp:
11/21/2014 10:04:40 AM (7 years ago)
Author:
obenland
Message:

WP.org Themes: Bring theme installer goodies to the front-end.

This brings most of the Backbone and Themes API-based functionality
from the admin's theme install screen to the front-end.

There are of course still loads of things to do, but it works
decently enough to share it with the world and give an idea of where
this is headed.

See https://make.wordpress.org/meta/2014/11/20/theme-repository-theme/
See #745.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/content-single.php

    r887 r1001  
    11<?php
    2 global $post;
    3 $theme = new Repo_Theme_Package($post);
     2include_once ABSPATH . '/wp-admin/includes/theme.php';
     3$theme = themes_api( 'theme_information', array( 'slug' => get_post()->post_name ) );
    44?>
    5 <div <?php post_class('single-theme'); ?> id="post-<?php the_ID(); ?>">
    6     <div class="theme-overlay">
    7         <div class="theme-about">
    8             <div class="theme-screenshots">
    9                 <div class="screenshot"><?php the_post_thumbnail(); ?></div>
     5
     6<div class="theme-backdrop"></div>
     7<div class="theme-wrap">
     8    <div class="theme-header">
     9        <button class="left dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show previous theme' ); ?></span></button>
     10        <button class="right dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show next theme' ); ?></span></button>
     11        <button class="close dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Close overlay' ); ?></span></button>
     12    </div>
     13    <div class="theme-about">
     14        <div class="theme-screenshots">
     15            <div class="screenshot"><?php the_post_thumbnail(); ?></div>
     16        </div>
     17
     18        <div class="theme-info">
     19            <h3 class="theme-name"><?php the_title(); ?><span
     20                    class="theme-version"><?php printf( __( 'Version: %s' ), $theme->version ); ?></span>
     21            </h3>
     22            <h4 class="theme-author"><?php printf( __( 'By %s' ), $theme->author ); ?></h4>
     23
     24            <p class="theme-description"><?php the_content(); ?></p>
     25
     26            <div class="rating rating-<?php echo round( $theme->rating, -1 ); ?>">
     27                <span class="one"></span>
     28                <span class="two"></span>
     29                <span class="three"></span>
     30                <span class="four"></span>
     31                <span class="five"></span>
     32
     33                <p class="votes"><?php printf( __( 'Based on %s ratings.' ), $theme->num_ratings ); ?></p>
    1034            </div>
    11             <div class="theme-info">
    12                 <h3 class="theme-name"><?php the_title(); ?>
    13                     <span class="theme-version">Version: <?php echo $theme->version; ?></span>
    14                 </h3>
    15                 <h4 class="theme-author">By <a href="<?php echo $theme->authorurl; ?>"> TODO the WordPress team</a></h4>
    16                 <p class="theme-description">
    17                     <?php the_content(); ?>
     35
     36            <div class="theme-stats">
     37                <div><strong><?php _e( 'Last updated:' ); ?></strong> <?php echo $theme->last_updated; ?></div>
     38                <div><strong><?php _e( 'Downloads:' ); ?></strong> <?php echo $theme->downloaded; ?></div>
     39                <div><a href="<?php echo esc_url( $theme->homepage ); ?>"><?php _e( 'Theme Homepage &raquo;' ); ?></a></div>
     40            </div>
     41
     42                <p class="theme-tags">
     43                    <span><?php _e( 'Tags:' ); ?></span>
     44                    <?php echo implode( ', ', $theme->tags ); ?>
    1845                </p>
    19                 <p class="theme-tags"><span>TODO Tags:</span> black, brown, orange, tan, white, yellow, light, one-column, two-columns, right-sidebar, fluid-layout, responsive-layout, custom-header, custom-menu, editor-style, featured-images, microformats, post-formats, rtl-language-support, sticky-post, translation-ready, accessibility-ready</p>
    20                
    21             </div>
    2246        </div>
    2347    </div>
     48
     49    <div class="theme-actions">
     50        <a href="<?php echo esc_url( '//downloads.wordpress.org/theme/' . $theme->slug . '.' . $theme->version . '.zip' ); ?>" class="button button-primary"><?php _e( 'Download' ); ?></a>
     51        <a href="<?php echo esc_url( $theme->preview_url ); ?>" class="button button-secondary"><?php _e( 'Preview' ); ?></a>
     52    </div>
    2453</div>
Note: See TracChangeset for help on using the changeset viewer.