WP Review - Version 3.3.1

Version Description

  • Rating stars are showing on search engine results page
Download this release

Release Info

Developer MyThemeShop
Plugin Icon 128x128 WP Review
Version 3.3.1
Comparing to
See all releases

Code changes from version 3.3 to 3.3.1

Files changed (3) hide show
  1. includes/functions.php +19 -22
  2. readme.txt +4 -1
  3. wp-review.php +2 -2
includes/functions.php CHANGED
@@ -93,25 +93,31 @@ function wp_review_get_data( $post_id = null ) {
93
  if ( $type != '' && is_singular($allowed_post_types) && is_main_query() ) {
94
  //if ( $type != '' && is_main_query() && in_array(get_post_type($post_id), $allowed_post_types)) {
95
  // using this second if() instead of the first will allow reviews to be displayed on archive pages, but it may mess up excerpts
96
- $review = '<div id="review" class="review-wrapper wp-review-'.$post_id.' ' . $class . ' delay-animation" >';
 
 
97
 
98
  /* Review title. */
99
- if( $heading != '' ){
100
- $review .= '<h5 class="review-title">' . __( $heading ) . '</h5>';
101
  }
102
 
103
-
104
  /* Review item. */
105
  if ( 'star' == $type ) {
106
- $bestresult = '<meta itemprop="best" content="5"/>';
107
  $best = '5';
108
  } elseif( 'point' == $type ) {
109
- $bestresult = '<meta itemprop="best" content="10"/>';
110
  $best = '10';
111
  } else { // percentage
112
- $bestresult = '<meta itemprop="best" content="100"/>';
113
  $best = '100';
114
  }
 
 
 
 
 
115
  if ( $items ) {
116
  $review .= '<ul class="review-list">';
117
  foreach( $items as $item ) {
@@ -170,7 +176,7 @@ function wp_review_get_data( $post_id = null ) {
170
  /* Review description. */
171
  if ( ! $hide_desc ) {
172
  if ( $desc ) {
173
- $review .= '<div class="review-desc" >';
174
  $review .= '<p class="review-summary-title"><strong>' . $desc_title . '</strong></p>';
175
  $review .= do_shortcode ( shortcode_unautop( wp_kses_post( wpautop( $desc ) ) ) );
176
  $review .= '</div><!-- .review-desc -->';
@@ -206,18 +212,10 @@ function wp_review_get_data( $post_id = null ) {
206
 
207
  $review .= '</div>';
208
 
209
- $review .= '<div itemscope itemtype="http://schema.org/Review">
210
- <span itemprop="itemReviewed" itemscope itemtype="http://schema.org/Thing">
211
- <meta itemprop="name" content="'.__( $heading ).'">
212
- </span>
213
- <span itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
214
- <meta itemprop="ratingValue" content="'.$total.'">
215
- <meta itemprop="bestRating" content="'.$best.'">
216
- </span>
217
- <span itemprop="author" itemscope itemtype="http://schema.org/Person">
218
- <meta itemprop="name" content="'. get_the_author() .'">
219
- </span>
220
- </div>';
221
  }
222
  }
223
 
@@ -282,8 +280,7 @@ function wp_review_get_data( $post_id = null ) {
282
 
283
  $review .= '</div>';
284
 
285
- // Is schema needed here?
286
- if ( $userTotal !== '0.0' ) {// dont'show if no user ratings
287
  $review .= '<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
288
  <meta itemprop="ratingValue" content="'.$userTotal.'" />
289
  <meta itemprop="reviewCount" content="'.$usersReviewsCount.'" />
93
  if ( $type != '' && is_singular($allowed_post_types) && is_main_query() ) {
94
  //if ( $type != '' && is_main_query() && in_array(get_post_type($post_id), $allowed_post_types)) {
95
  // using this second if() instead of the first will allow reviews to be displayed on archive pages, but it may mess up excerpts
96
+ $review = '<div itemscope itemtype="http://schema.org/Review" id="review" class="review-wrapper wp-review-'.$post_id.' ' . $class . ' delay-animation" >';
97
+
98
+ //$review .= '<meta itemprop="datePublished" content="">';
99
 
100
  /* Review title. */
101
+ if ( $heading != '' ) {
102
+ $review .= '<h5 itemprop="itemReviewed" itemscope itemtype="http://schema.org/Thing" class="review-title"><span itemprop="name">' . esc_html( $heading ) . '</span></h5>';
103
  }
104
 
 
105
  /* Review item. */
106
  if ( 'star' == $type ) {
107
+ //$bestresult = '<meta itemprop="bestRating" content="5"/>';
108
  $best = '5';
109
  } elseif( 'point' == $type ) {
110
+ //$bestresult = '<meta itemprop="bestRating" content="10"/>';
111
  $best = '10';
112
  } else { // percentage
113
+ //$bestresult = '<meta itemprop="bestRating" content="100"/>';
114
  $best = '100';
115
  }
116
+
117
+ $review .= '<span itemprop="author" itemscope itemtype="http://schema.org/Person">';
118
+ $review .= '<meta itemprop="name" content="'. esc_attr( get_the_author() ) .'">';
119
+ $review .= '</span>';
120
+
121
  if ( $items ) {
122
  $review .= '<ul class="review-list">';
123
  foreach( $items as $item ) {
176
  /* Review description. */
177
  if ( ! $hide_desc ) {
178
  if ( $desc ) {
179
+ $review .= '<div class="review-desc" itemprop="description">';
180
  $review .= '<p class="review-summary-title"><strong>' . $desc_title . '</strong></p>';
181
  $review .= do_shortcode ( shortcode_unautop( wp_kses_post( wpautop( $desc ) ) ) );
182
  $review .= '</div><!-- .review-desc -->';
212
 
213
  $review .= '</div>';
214
 
215
+ $review .= '<span itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
216
+ <meta itemprop="ratingValue" content="'.$total.'">
217
+ <meta itemprop="bestRating" content="'.$best.'">
218
+ </span>';
 
 
 
 
 
 
 
 
219
  }
220
  }
221
 
280
 
281
  $review .= '</div>';
282
 
283
+ if ( $userTotal !== '0.0' && $total === '' ) {// dont'show if no user ratings and there is review
 
284
  $review .= '<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
285
  <meta itemprop="ratingValue" content="'.$userTotal.'" />
286
  <meta itemprop="reviewCount" content="'.$usersReviewsCount.'" />
readme.txt CHANGED
@@ -4,7 +4,7 @@ Creator's website link: http://mythemeshop.com/plugins/wp-review/
4
  Tags: review, wp review, rating, wp rating, user rating, google rating, star rating, product review
5
  Requires at least: 3.0.1
6
  Tested up to: 4.2
7
- Stable tag: 3.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -89,6 +89,9 @@ Please disable all plugins and check if rating is working properly. Then you can
89
 
90
  == Changelog ==
91
 
 
 
 
92
  = 3.3 =
93
  * Fixed Google structured data testing tool errors and warnings
94
 
4
  Tags: review, wp review, rating, wp rating, user rating, google rating, star rating, product review
5
  Requires at least: 3.0.1
6
  Tested up to: 4.2
7
+ Stable tag: 3.3.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
89
 
90
  == Changelog ==
91
 
92
+ = 3.3.1 =
93
+ * Rating stars are showing on search engine results page
94
+
95
  = 3.3 =
96
  * Fixed Google structured data testing tool errors and warnings
97
 
wp-review.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WP Review
4
  * Plugin URI: http://mythemeshop.com/plugins/wp-review/
5
  * Description: Create reviews! Choose from stars, percentages or points for review scores. Supports Retina Display, WPMU and Unlimited Color Schemes.
6
- * Version: 3.3
7
  * Author: MyThemesShop
8
  * Author URI: http://mythemeshop.com/
9
  *
@@ -26,7 +26,7 @@ if ( ! defined( 'ABSPATH' ) ) exit;
26
  if ( ! defined( 'MTS_WP_REVIEW_DB_TABLE' ) ) {
27
 
28
  /* Plugin version */
29
- define( 'WP_REVIEW_PLUGIN_VERSION', '3.2.7' );
30
 
31
  /* Sets the custom db table name. */
32
  define( 'MTS_WP_REVIEW_DB_TABLE', 'mts_wp_reviews' );
3
  * Plugin Name: WP Review
4
  * Plugin URI: http://mythemeshop.com/plugins/wp-review/
5
  * Description: Create reviews! Choose from stars, percentages or points for review scores. Supports Retina Display, WPMU and Unlimited Color Schemes.
6
+ * Version: 3.3.1
7
  * Author: MyThemesShop
8
  * Author URI: http://mythemeshop.com/
9
  *
26
  if ( ! defined( 'MTS_WP_REVIEW_DB_TABLE' ) ) {
27
 
28
  /* Plugin version */
29
+ define( 'WP_REVIEW_PLUGIN_VERSION', '3.3.1' );
30
 
31
  /* Sets the custom db table name. */
32
  define( 'MTS_WP_REVIEW_DB_TABLE', 'mts_wp_reviews' );