Customize: Add a link to theme reviews in the theme details modal in the Customizer and on Add Themes screen.

Props celloexpressions, Travel_girl, Ixium, marco-peralta, dd32.
Fixes #36612.
Built from https://develop.svn.wordpress.org/trunk@44975


git-svn-id: http://core.svn.wordpress.org/trunk@44806 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-03-21 22:02:51 +00:00
parent 964d328768
commit 30491f2410
5 changed files with 19 additions and 6 deletions

View File

@ -3266,7 +3266,12 @@ function wp_ajax_query_themes() {
wp_unslash( $_REQUEST['request'] ), wp_unslash( $_REQUEST['request'] ),
array( array(
'per_page' => 20, 'per_page' => 20,
'fields' => $theme_field_defaults, 'fields' => array_merge(
(array) $theme_field_defaults,
array(
'reviews_url' => true, // Explicitly request the reviews URL to be linked from the Add Themes screen.
)
),
) )
); );

View File

@ -721,12 +721,12 @@ function customize_themes_print_templates() {
<# if ( data.stars && 0 != data.num_ratings ) { #> <# if ( data.stars && 0 != data.num_ratings ) { #>
<div class="theme-rating"> <div class="theme-rating">
{{{ data.stars }}} {{{ data.stars }}}
<span class="num-ratings"> <a class="num-ratings" target="_blank" href="{{ data.reviews_url }}">
<?php <?php
/* translators: %s: number of ratings */ /* translators: %s: number of ratings */
echo sprintf( __( '(%s ratings)' ), '{{ data.num_ratings }}' ); echo sprintf( __( '(%s ratings) <span class="screen-reader-text">link to view ratings opens in a new tab</span>' ), '{{ data.num_ratings }}' );
?> ?>
</span> </a>
</div> </div>
<# } #> <# } #>

View File

@ -335,7 +335,12 @@ if ( $tab ) {
<# if ( data.rating ) { #> <# if ( data.rating ) { #>
<div class="theme-rating"> <div class="theme-rating">
{{{ data.stars }}} {{{ data.stars }}}
<span class="num-ratings">({{ data.num_ratings }})</span> <a class="num-ratings" href="{{ data.reviews_url }}">
<?php
/* translators: %s: number of ratings */
echo sprintf( __( '(%s ratings)' ), '{{ data.num_ratings }}' );
?>
</a>
</div> </div>
<# } else { #> <# } else { #>
<span class="no-rating"><?php _e( 'This theme has not been rated yet.' ); ?></span> <span class="no-rating"><?php _e( 'This theme has not been rated yet.' ); ?></span>

View File

@ -5729,6 +5729,9 @@ final class WP_Customize_Manager {
// Arguments for all queries. // Arguments for all queries.
$wporg_args = array( $wporg_args = array(
'per_page' => 100, 'per_page' => 100,
'fields' => array(
'reviews_url' => true, // Explicitly request the reviews URL to be linked from the customizer.
),
); );
$args = array_merge( $wporg_args, $args ); $args = array_merge( $wporg_args, $args );

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.2-alpha-44974'; $wp_version = '5.2-alpha-44975';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.