Making WordPress.org

Changeset 8474


Ignore:
Timestamp:
03/18/2019 02:49:56 AM (6 years ago)
Author:
dd32
Message:

Plugin Directory: Link directly to the Reviews rather than using the ?p= syntax.

Fixes #4286.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
Files:
2 edited

Legend:

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

    r7877 r8474  
    5656            $reviews = $wpdb->get_results( $wpdb->prepare(
    5757                "SELECT
    58                     ID, post_content, post_title, post_author, post_modified,
     58                    ID, post_name, post_content, post_title, post_author, post_modified,
    5959                    r.rating as post_rating
    6060                FROM ratings r
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-reviews.php

    r8075 r8474  
    3131            foreach ( $reviews as $review ) :
    3232                setup_postdata( $review );
     33                if ( !empty( $review->post_name ) ) {
     34                    $url = 'https://wordpress.org/support/topic/' . $review->post_name . '/';
     35                } else {
     36                    $url = add_query_arg( array( 'p' => $review->ID ), 'https://wordpress.org/support/plugin/' );
     37                }
    3338                ?>
    3439                <article class="plugin-review">
     
    3742                    </div><div class="review">
    3843                        <header>
    39                             <?php if ( ! empty( $review->ID ) ) : ?>
    40                                 <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>
    41                             <?php else : ?>
    42                                 <h3 class="review-title"><?php echo get_the_title( $review ); ?></h3>
    43                             <?php endif; ?>
     44                            <h3 class="review-title"><a class="url" href="<?php echo esc_url( $url ); ?>"><?php echo get_the_title( $review ); ?></a></h3>
    4445                            <?php echo Template::dashicons_stars( $review->post_rating ); ?>
    4546                            <span class="review-author author vcard"><?php the_author_posts_link(); ?></span>
Note: See TracChangeset for help on using the changeset viewer.