Making WordPress.org


Ignore:
Timestamp:
03/17/2015 11:37:22 PM (10 years ago)
Author:
obenland
Message:

WP.org Themes: Design parity between modal and singular theme page.

  • Uses Dashicons to display rating stars.
  • Removes the dependency on admin themes styles.

See #950.

File:
1 edited

Legend:

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

    r1383 r1409  
    33$theme = themes_api('theme_information', array( 'slug' => $slug ) );
    44?>
     5<div class="theme-navigation">
     6    <a class="close" rel="home" href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php _e( 'Return to Themes List', 'wporg-themes' ); ?></a>
     7    <?php the_post_navigation( array(
     8        'prev_text' => '<span class="screen-reader-text">' . __( 'Next', 'wporg-themes' ) . '</span>',
     9        'next_text' => '<span class="screen-reader-text">' . __( 'Previous', 'wporg-themes' ) . '</span>',
     10    ) ); ?>
     11</div>
    512<div class="theme-wrap">
    613    <div class="theme-about hentry" itemscope itemtype="http://schema.org/CreativeWork">
     
    1219        <?php endif; ?>
    1320
    14         <div class="theme-head">
     21        <div>
    1522            <h3 class="theme-name entry-title" itemprop="name"><?php the_title(); ?></h3>
    1623            <h4 class="theme-author">
    17                 <?php printf( _x( 'By %s', 'post author', 'wporg-themes' ), sprintf( '<a href="https://profiles.wordpress.org/%s"><span class="author" itemprop="author">%s</span></a>', get_the_author_meta( 'nicename' ), esc_html( get_the_author() ) ) ); ?>
     24                <?php printf( _x( 'by %s', 'post author', 'wporg-themes' ), sprintf( '<a href="https://wordpress.org/themes/author/%s/"><span class="author" itemprop="author">%s</span></a>', get_the_author_meta( 'nicename' ), esc_html( get_the_author() ) ) ); ?>
    1825            </h4>
     26        </div>
    1927
    20             <div class="theme-actions">
    21                 <a href="<?php echo esc_url( '//wp-themes.com/' . $slug ); ?>" class="button button-secondary"><?php _e( 'Preview' ); ?></a>
    22                 <a href="<?php echo esc_url( '//downloads.wordpress.org/theme/' . $slug . '.' . $theme->version . '.zip' ); ?>" class="button button-primary"><?php _e( 'Download' ); ?></a>
     28        <div class="theme-head">
     29            <div class="theme-actions clear">
     30                <a href="<?php echo esc_url( '//wp-themes.com/' . $slug ); ?>" class="button button-secondary alignleft"><?php _e( 'Preview' ); ?></a>
     31                <a href="<?php echo esc_url( '//downloads.wordpress.org/theme/' . $slug . '.' . $theme->version . '.zip' ); ?>" class="button button-primary alignright"><?php _e( 'Download' ); ?></a>
    2332            </div>
    2433
     
    4453
    4554        <div class="theme-info">
    46             <div class="screenshot"><?php the_post_thumbnail( '798' ); ?></div>
     55            <div class="screenshot"><?php the_post_thumbnail( '571' ); ?></div>
    4756
    4857            <div class="theme-description entry-summary" itemprop="description"><?php the_content(); ?></div>
     
    106115                    }
    107116                </script>
    108                 <p class="total-downloads"><?php printf( __( 'Total downloads: %s' ), '<strong>' . $theme->downloaded . '</strong>' ); ?></p>
     117                <p class="total-downloads"><?php printf( __( 'Total downloads: %s' ), '<strong>' . number_format_i18n( $theme->downloaded ) . '</strong>' ); ?></p>
    109118            </div><!-- .theme-downloads -->
    110119        </div><!-- .theme-info -->
     
    112121        <div class="theme-meta">
    113122            <div class="theme-ratings" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
    114                 <meta itemprop="ratingValue" content="<?php echo esc_attr( number_format_i18n( $theme->rating / 20, 1 ) ); ?>"/>
    115123                <meta itemprop="ratingCount" content="<?php echo esc_attr( $theme->num_ratings ); ?>"/>
    116124                <h4><?php _e( 'Ratings', 'wporg-themes' ); ?></h4>
    117125
    118                 <div class="rating">
    119                     <div class="star-holder">
    120                         <div class="star-rating" style="width: <?php echo esc_attr( number_format_i18n( $theme->rating, 1 ) ); ?>%">
    121                             <?php printf( __( '%d stars', 'wporg-themes' ), number_format_i18n( $theme->rating / 20 ) ); ?>
    122                         </div>
     126                <?php if ( ! empty( $theme->ratings ) ) : ?>
     127                    <div class="rating rating-<?php echo esc_attr( number_format( $theme->rating ) ); ?>">
     128                        <span class="one"></span>
     129                        <span class="two"></span>
     130                        <span class="three"></span>
     131                        <span class="four"></span>
     132                        <span class="five"></span>
     133                        <p class="description"><?php printf( __( '%s out of 5 stars.', 'wporg-themes' ), '<span itemprop="ratingValue">' . number_format_i18n( $theme->rating / 20, 1 )  . '</span>' ); ?></p>
    123134                    </div>
    124                     <p class="description"><?php printf( __( '%s out of 5 stars.', 'wporg-themes' ), number_format_i18n( $theme->rating / 20, 1 ) ); ?></p>
    125                 </div>
     135                <?php else : ?>
     136                    <div class="rating">
     137                        <div class="ratings"><?php _e( 'This theme has not been rated yet.', 'wporg-themes' ); ?></div>
     138                    </div>
     139                <?php endif; ?>
    126140
    127141                <?php if ( ! empty( $theme->ratings ) && ! empty( $theme->num_ratings ) ) : ?>
     
    130144                        foreach ( $theme->ratings as $key => $rate_count ) :
    131145                            // Hack to have descending key/value pairs.
    132                             $key        = 6 - $key;
    133                             $rate_count = $theme->ratings[ $key ];
     146                            $key = 6 - $key;
    134147                    ?>
    135148                    <li class="counter-container">
    136                         <a href="//wordpress.org/support/view/theme-reviews/<?php echo esc_attr( $slug ); ?>?filter=<?php echo $key; ?>" title="<?php printf( _n( 'Click to see reviews that provided a rating of %d star', 'Click to see reviews that provided a rating of %d stars', $key, 'wporg-themes' ), $key ); ?>">
    137                             <span class="counter-label"><?php printf( __( '%d stars', 'wporg-themes' ), $key ); ?></span>
     149                        <a href="//wordpress.org/support/view/theme-reviews/<?php echo esc_attr( $slug ); ?>?filter=<?php echo $key; ?>" title="<?php echo esc_attr( sprintf( _n( 'Click to see reviews that provided a rating of %d star', 'Click to see reviews that provided a rating of %d stars', $key, 'wporg-themes' ), $key ) ); ?>">
     150                            <span class="counter-label"><?php printf( _n( '%d star', '%d stars', $key, 'wporg-themes' ), $key ); ?></span>
    138151                            <span class="counter-back">
    139                                 <span class="counter-bar" style="width: <?php echo 100 * ( $rate_count / $theme->num_ratings ); ?>px;"></span>
     152                                <span class="counter-bar" style="width: <?php echo 100 * ( $theme->ratings[ $key ] / $theme->num_ratings ); ?>%;"></span>
    140153                            </span>
    141                             <span class="counter-count"><?php echo $rate_count; ?></span>
     154                            <span class="counter-count"><?php echo $theme->ratings[ $key ]; ?></span>
    142155                        </a>
    143156                    </li>
     
    145158                </ul>
    146159                <?php endif; ?>
     160
     161                <a class="button button-secondary" href="https://wordpress.org/support/view/theme-reviews/<?php echo esc_attr( $slug ); ?>#postform"><?php _e( 'Add your review', 'wporg-themes' ); ?></a>
    147162            </div><!-- .theme-rating -->
    148163
     
    174189        </div><!-- .theme-meta -->
    175190    </div>
    176     <div class="theme-footer">
    177         <a class="index-link" rel="home" href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php _e( 'Return to Themes List', 'wporg-themes' ); ?></a>
    178         <?php the_post_navigation( array(
    179             'prev_text' => '<span class="screen-reader-text">' . __( 'Next', 'wporg-themes' ) . '</span>',
    180             'next_text' => '<span class="screen-reader-text">' . __( 'Previous', 'wporg-themes' ) . '</span>',
    181         ) ); ?>
    182     </div>
    183191</div>
Note: See TracChangeset for help on using the changeset viewer.