Making WordPress.org

Changeset 2998


Ignore:
Timestamp:
04/22/2016 06:17:23 AM (10 years ago)
Author:
dd32
Message:

Plugin Directory: Add ratings count postmeta display to admin and plugin cards.
Still to come is a Widget to allow rating & reviewing a plugin.

See #1575

Location:
sites/trunk/wordpress.org/public_html/wp-content
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/list-table/class-plugin-posts.php

    r2994 r2998  
    159159         */
    160160        public function column_rating( $post ) {
    161                 $rating = (string) get_post_meta( $post->ID, 'avg_rating', true );
    162                 if ( ! empty( $rating ) && function_exists( 'wporg_get_dashicons_stars' ) ) {
    163                         echo wporg_get_dashicons_stars( $rating / 20 );
     161                if ( function_exists( 'wporg_get_dashicons_stars' ) ) {
     162                        echo wporg_get_dashicons_stars( get_post_meta( $post->ID, 'rating', true ) );
    164163                }
    165164        }
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php

    r2996 r2998  
    433433                                return $single ? $count : array( $count );                             
    434434                                break;
     435                        case 'rating':
     436                                $post = get_post( $object_id );
     437                                // The WordPress.org global ratings functions
     438                                if ( ! function_exists( 'wporg_get_rating_avg' ) ) {
     439                                        break;
     440                                }
     441                                $rating = wporg_get_rating_avg( 'plugin', $post->post_name );
     442
     443                                return $single ? $rating : array( $rating );
     444                                break;
    435445                }
    436446                return $value;
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/plugin-card.php

    r2612 r2998  
    1515
    1616        <div class="plugin-card-bottom">
    17                 <!-- <div class="vers column-rating">
    18                         <div class='wporg-ratings' title='4 out of 5 stars' style='color:#ffb900;'><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-empty"></span></div><span class="num-ratings" title="Rating based on 813 reviews">(813)</span>
    19                 </div> -->
     17                <div class="vers column-rating">
     18                        <?php
     19                                if ( function_exists( 'wporg_get_dashicons_stars' ) ) {
     20                                        echo wporg_get_dashicons_stars( get_post_meta( $post->ID, 'rating', true ) );
     21                                }
     22                        ?>
     23                </div>
    2024                <div class="column-updated">
    2125                        <strong><?php _e( 'Last Updated:', 'wporg-plugins' ); ?></strong> <?php echo wporg_plugins_template_last_updated(); ?>
Note: See TracChangeset for help on using the changeset viewer.