WordPress.org

Making WordPress.org

Changeset 5229


Ignore:
Timestamp:
03/31/2017 05:54:43 PM (5 years ago)
Author:
obenland
Message:

Plugin Directory: Use template functions to display reviews.

Allows us to take advantage of default filters and looks a little cleaner.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-reviews.php

    r5037 r5229  
    2828        <div class="plugin-reviews">
    2929            <?php
    30         foreach ( $reviews as $review ) :
    31                 $reviewer = get_user_by( 'id', $review->post_author );
    32                 if ( ! $reviewer ) :
    33                     continue;
    34                 endif;
     30            foreach ( $reviews as $review ) :
     31                setup_postdata( $review );
    3532                ?>
    3633                <article class="plugin-review">
    3734                    <div class="review-avatar">
    38                         <?php echo get_avatar( $reviewer->ID, 60 ); ?>
     35                        <?php echo get_avatar( get_the_author_meta( 'ID' ), 60 ); ?>
    3936                    </div><div class="review">
    4037                        <header>
    41                             <?php if ( !empty( $review->ID ) ) : ?>
    42                                 <h3 class="review-title"><a class="url" href="<?php echo esc_url( add_query_arg( array( 'p' => $review->ID ), 'https://wordpress.org/support/plugin/' ) ); ?>"><?php echo $review->post_title; ?></a></h3>
     38                            <?php if ( ! empty( $review->ID ) ) : ?>
     39                                <h3 class="review-title"><a class="url" href="<?php echo esc_url( add_query_arg( array( 'p' => $review->ID ), 'https://wordpress.org/support/plugin/' ) ); ?>"><?php echo get_the_title( $review ); ?></a></h3>
    4340                            <?php else: ?>
    44                                 <h3 class="review-title"><?php echo $review->post_title; ?></h3>
     41                                <h3 class="review-title"><?php echo get_the_title( $review ); ?></h3>
    4542                            <?php endif; ?>
    4643                            <?php echo Template::dashicons_stars( $review->post_rating ); ?>
    47                             <span class="review-author author vcard"><a class="url fn n" href="<?php echo esc_url( get_author_posts_url( $reviewer->ID ) ); ?>"><?php echo Template::encode( $reviewer->display_name ); ?></a></span>
     44                            <span class="review-author author vcard"><?php the_author_posts_link(); ?></span>
    4845                        </header>
    49                         <p class="review-content"><?php echo $review->post_content; ?></p>
     46                        <div class="review-content"><?php the_content(); ?></div>
    5047                    </div>
    5148                </article>
    5249            <?php endforeach; ?>
    5350        </div>
     51        <?php wp_reset_postdata(); ?>
    5452
    5553        <a class="reviews-link" href="<?php echo esc_url( 'https://wordpress.org/support/plugin/' . get_post()->post_name . '/reviews/' ); ?>">
Note: See TracChangeset for help on using the changeset viewer.