Version Description
- Fixed average star rating number issue.
- Added New filter to exclude post types.
- Updated filter list.
Download this release
Release Info
Developer | MyThemeShop |
Plugin | WP Review |
Version | 3.1 |
Comparing to | |
See all releases |
Code changes from version 3.0 to 3.1
- admin/metaboxes.php +1 -1
- assets/css/wp-review-tab-widget.css +0 -3
- assets/css/wp-review.css +2 -1
- assets/js/main.js +5 -0
- assets/js/wp-review-tab-widget.js +5 -0
- filter-list.php +83 -0
- includes/functions.php +13 -10
- readme.txt +6 -1
- wp-review.php +1 -1
admin/metaboxes.php
CHANGED
@@ -21,7 +21,7 @@ add_action( 'save_post', 'wp_review_save_postdata', 10, 2 );
|
|
21 |
*/
|
22 |
function wp_review_add_meta_boxes() {
|
23 |
$post_types = get_post_types( array('public' => true), 'names' );
|
24 |
-
$excluded_post_types = array('attachment');
|
25 |
|
26 |
foreach ($post_types as $post_type) {
|
27 |
if (!in_array($post_type, $excluded_post_types)) {
|
21 |
*/
|
22 |
function wp_review_add_meta_boxes() {
|
23 |
$post_types = get_post_types( array('public' => true), 'names' );
|
24 |
+
$excluded_post_types = apply_filters('wp_review_excluded_post_types', array('attachment'));
|
25 |
|
26 |
foreach ($post_types as $post_type) {
|
27 |
if (!in_array($post_type, $excluded_post_types)) {
|
assets/css/wp-review-tab-widget.css
CHANGED
@@ -142,9 +142,6 @@
|
|
142 |
}
|
143 |
|
144 |
/* Rating... */
|
145 |
-
.wp_review_tab_widget_content .review-total-only {
|
146 |
-
|
147 |
-
}
|
148 |
.review-total-only.small-thumb {
|
149 |
font-size: 15px;
|
150 |
font-weight: bold;
|
142 |
}
|
143 |
|
144 |
/* Rating... */
|
|
|
|
|
|
|
145 |
.review-total-only.small-thumb {
|
146 |
font-size: 15px;
|
147 |
font-weight: bold;
|
assets/css/wp-review.css
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
/*
|
2 |
Plugin: WP Review
|
3 |
Created By: MyThemeShop.com
|
|
|
4 |
*/
|
5 |
.review-wrapper {
|
6 |
border: 1px solid #e7e7e7;
|
@@ -13,7 +14,7 @@
|
|
13 |
background-color: #f6f6f6;
|
14 |
border-bottom: 1px solid #e7e7e7;
|
15 |
margin: 0;
|
16 |
-
padding: 10px;
|
17 |
}
|
18 |
|
19 |
.review-wrapper .review-list {
|
1 |
/*
|
2 |
Plugin: WP Review
|
3 |
Created By: MyThemeShop.com
|
4 |
+
Version: 3.1
|
5 |
*/
|
6 |
.review-wrapper {
|
7 |
border: 1px solid #e7e7e7;
|
14 |
background-color: #f6f6f6;
|
15 |
border-bottom: 1px solid #e7e7e7;
|
16 |
margin: 0;
|
17 |
+
padding: 10px 15px;
|
18 |
}
|
19 |
|
20 |
.review-wrapper .review-list {
|
assets/js/main.js
CHANGED
@@ -1,3 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
1 |
jQuery(document).ready(function($){
|
2 |
$('.review-total-star.allowed-to-rate.has-not-rated-yet a').hover(function(){
|
3 |
$(this).addClass( "hovered" ).prevAll().addClass( "hovered" );
|
1 |
+
/*-----------------------------------
|
2 |
+
/* WP Review Plugin by MyThemeShop
|
3 |
+
/* mythemeshop.com
|
4 |
+
/*----------------------------------*/
|
5 |
+
|
6 |
jQuery(document).ready(function($){
|
7 |
$('.review-total-star.allowed-to-rate.has-not-rated-yet a').hover(function(){
|
8 |
$(this).addClass( "hovered" ).prevAll().addClass( "hovered" );
|
assets/js/wp-review-tab-widget.js
CHANGED
@@ -1,3 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
1 |
function wp_review_tab_loadTabContent(tab_name, page_num, container, args_obj) {
|
2 |
|
3 |
var container = jQuery(container);
|
1 |
+
/*-----------------------------------
|
2 |
+
/* WP Review Plugin by MyThemeShop
|
3 |
+
/* mythemeshop.com
|
4 |
+
/*----------------------------------*/
|
5 |
+
|
6 |
function wp_review_tab_loadTabContent(tab_name, page_num, container, args_obj) {
|
7 |
|
8 |
var container = jQuery(container);
|
filter-list.php
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
List of available filters in WP Review plugin.
|
4 |
+
You can use these filterns in your theme in funtions.php file
|
5 |
+
and set different default settings.
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Set default colors for new reviews
|
9 |
+
function new_default_review_colors($colors) {
|
10 |
+
$colors = array(
|
11 |
+
'color' => '#1E73BE',
|
12 |
+
'fontcolor' => '#555',
|
13 |
+
'bgcolor1' => '#E7E7E7',
|
14 |
+
'bgcolor2' => '#fff',
|
15 |
+
'bordercolor' => '#e7e7e7'
|
16 |
+
);
|
17 |
+
return $colors;
|
18 |
+
}
|
19 |
+
add_filter( 'wp_review_default_colors', 'new_default_review_colors' );
|
20 |
+
|
21 |
+
// Set colors for ALL displayed reviews
|
22 |
+
function mts_new_review_colors($colors, $id) {
|
23 |
+
$colors['bgcolor1'] = '#ff0000';
|
24 |
+
return $colors;
|
25 |
+
}
|
26 |
+
add_filter( 'wp_review_colors', 'mts_new_review_colors', 10, 2 );
|
27 |
+
|
28 |
+
// Set location for ALL displayed reviews
|
29 |
+
function mts_new_review_location($position, $id) {
|
30 |
+
$position = 'bottom';
|
31 |
+
return $position;
|
32 |
+
}
|
33 |
+
add_filter( 'wp_review_location', 'mts_new_review_location', 10, 2 );
|
34 |
+
|
35 |
+
// Set default location for new reviews
|
36 |
+
function mts_new_default_review_location($position) {
|
37 |
+
$position = 'bottom';
|
38 |
+
return $position;
|
39 |
+
}
|
40 |
+
add_filter( 'wp_review_default_location', 'mts_new_default_review_location' );
|
41 |
+
|
42 |
+
// Hide fields in "item" meta box
|
43 |
+
function mts_hide_item_metabox_fields($fields) {
|
44 |
+
unset($fields['location'], $fields['fontcolor'], $fields['bordercolor']);
|
45 |
+
// Or remove all with:
|
46 |
+
// $fields = array();
|
47 |
+
return $fields;
|
48 |
+
}
|
49 |
+
add_filter( 'wp_review_metabox_item_fields', 'mts_hide_item_metabox_fields' );
|
50 |
+
|
51 |
+
// Hide selected review types in metabox dropdown
|
52 |
+
function mts_hide_review_types($types) {
|
53 |
+
unset($types['point'], $types['percentage']); // remove types
|
54 |
+
$types['star'] = __('Enable Reviews'); // Change label
|
55 |
+
return $types;
|
56 |
+
}
|
57 |
+
add_filter( 'wp_review_metabox_types', 'mts_hide_review_types' );
|
58 |
+
|
59 |
+
// Add default criteria
|
60 |
+
function mts_add_default_criteria($items) {
|
61 |
+
$items = array(__('Audio'), __('Visual'), __('UX'), __('Price'));
|
62 |
+
return $items;
|
63 |
+
}
|
64 |
+
add_filter( 'wp_review_default_criteria', 'mts_add_default_criteria' );
|
65 |
+
|
66 |
+
// Customize wp_review_show_total() output
|
67 |
+
function mts_custom_review_total($content, $id, $type, $total) {
|
68 |
+
if (get_the_title($id) == 'Special Post With Blue Rating') {
|
69 |
+
$color = '#0000FF';
|
70 |
+
$content = preg_replace('/"review-type-[^"]+"/', '$0 style="background-color: '.$color.';"', $content);
|
71 |
+
}
|
72 |
+
return $content;
|
73 |
+
}
|
74 |
+
add_filter('wp_review_show_total', 'mts_custom_review_total', 10, 4);
|
75 |
+
|
76 |
+
// Exclude post types
|
77 |
+
function mts_wp_review_exclude_post_types($excluded) {
|
78 |
+
// default: $excluded = array('attachment');
|
79 |
+
$excluded[] = 'page'; // Don't allow reviews on pages
|
80 |
+
return $excluded;
|
81 |
+
}
|
82 |
+
add_filter( 'wp_review_excluded_post_types', 'mts_wp_review_exclude_post_types' );
|
83 |
+
?>
|
includes/functions.php
CHANGED
@@ -53,7 +53,7 @@ function wp_review_get_data() {
|
|
53 |
$class = 'percentage-point';
|
54 |
}
|
55 |
$post_types = get_post_types( array('public' => true), 'names' );
|
56 |
-
$excluded_post_types = array('attachment');
|
57 |
$allowed_post_types = array();
|
58 |
foreach ($post_types as $i => $post_type) {
|
59 |
if (!in_array($post_type, $excluded_post_types)) {
|
@@ -63,7 +63,7 @@ function wp_review_get_data() {
|
|
63 |
|
64 |
/**
|
65 |
* Add the custom data from the meta box to the main query an
|
66 |
-
* make sure the hook only apply on
|
67 |
*/
|
68 |
if ( $type != '' && is_singular($allowed_post_types) && is_main_query() ) {
|
69 |
|
@@ -101,7 +101,7 @@ function wp_review_get_data() {
|
|
101 |
$review .= '<li>';
|
102 |
|
103 |
if ( 'point' == $type ) {
|
104 |
-
$review .= '<span>' . wp_kses_post( $item['wp_review_item_title'] ) . ' - ' . $item['wp_review_item_star'] . '/10</span>';
|
105 |
} elseif( 'percentage' == $type ) {
|
106 |
$review .= '<span>' . wp_kses_post( $item['wp_review_item_title'] ) . ' - ' . $item['wp_review_item_star'] . '%' . '</span>';
|
107 |
} else {
|
@@ -125,7 +125,7 @@ function wp_review_get_data() {
|
|
125 |
$review .= '<i class="mts-icon-star"></i>';
|
126 |
$review .= '</div><!-- .review-result -->';
|
127 |
} elseif ( 'point' == $type ) {
|
128 |
-
$review .= '<div class="review-result" style="width:' . $result . '%;">' . $item['wp_review_item_star'] . '/10</div>';
|
129 |
} else {
|
130 |
$review .= '<div class="review-result" style="width:' . $result . '%;">' . $item['wp_review_item_star'] . '</div>';
|
131 |
}
|
@@ -151,10 +151,10 @@ function wp_review_get_data() {
|
|
151 |
|
152 |
if ( 'percentage' == $type ) {
|
153 |
$review .= '<span class="review-total-box"><span itemprop="review">' . $total . '</span> <i class="percentage-icon">%</i>' . '</span>';
|
154 |
-
}
|
155 |
-
|
156 |
-
|
157 |
-
$review .= '<span class="review-total-box" itemprop="review">' . $total . '
|
158 |
}
|
159 |
|
160 |
if ( 'star' == $type ) {
|
@@ -265,7 +265,8 @@ function wp_review_get_data() {
|
|
265 |
|
266 |
|
267 |
$review .= '</div><!-- #review -->';
|
268 |
-
|
|
|
269 |
return $review;
|
270 |
} else {
|
271 |
return '';
|
@@ -319,7 +320,7 @@ function wp_review_show_total($echo = true, $class = 'review-total-only') {
|
|
319 |
if ( 'percentage' == $type ) {
|
320 |
$review .= '<span class="review-total-box"><span itemprop="review">' . $total . '</span> <i class="percentage-icon">%</i>' . '</span>';
|
321 |
} elseif ( 'point' == $type ) {
|
322 |
-
$review .= '<span class="review-total-box" itemprop="review">' . $total . '/10</span></span>';
|
323 |
} else {
|
324 |
// star
|
325 |
$review .= '<div class="review-total-star">';
|
@@ -343,6 +344,8 @@ function wp_review_show_total($echo = true, $class = 'review-total-only') {
|
|
343 |
$review .= '</div>';
|
344 |
}
|
345 |
|
|
|
|
|
346 |
if ($echo)
|
347 |
echo $review;
|
348 |
else
|
53 |
$class = 'percentage-point';
|
54 |
}
|
55 |
$post_types = get_post_types( array('public' => true), 'names' );
|
56 |
+
$excluded_post_types = apply_filters('wp_review_excluded_post_types', array('attachment'));
|
57 |
$allowed_post_types = array();
|
58 |
foreach ($post_types as $i => $post_type) {
|
59 |
if (!in_array($post_type, $excluded_post_types)) {
|
63 |
|
64 |
/**
|
65 |
* Add the custom data from the meta box to the main query an
|
66 |
+
* make sure the hook only apply on allowed post types
|
67 |
*/
|
68 |
if ( $type != '' && is_singular($allowed_post_types) && is_main_query() ) {
|
69 |
|
101 |
$review .= '<li>';
|
102 |
|
103 |
if ( 'point' == $type ) {
|
104 |
+
$review .= '<span>' . wp_kses_post( $item['wp_review_item_title'] ) . ' - ' . $item['wp_review_item_star'] . '/'.__('10','mts-review').'</span>';
|
105 |
} elseif( 'percentage' == $type ) {
|
106 |
$review .= '<span>' . wp_kses_post( $item['wp_review_item_title'] ) . ' - ' . $item['wp_review_item_star'] . '%' . '</span>';
|
107 |
} else {
|
125 |
$review .= '<i class="mts-icon-star"></i>';
|
126 |
$review .= '</div><!-- .review-result -->';
|
127 |
} elseif ( 'point' == $type ) {
|
128 |
+
$review .= '<div class="review-result" style="width:' . $result . '%;">' . $item['wp_review_item_star'] . '/'.__('10','mts-review').'</div>';
|
129 |
} else {
|
130 |
$review .= '<div class="review-result" style="width:' . $result . '%;">' . $item['wp_review_item_star'] . '</div>';
|
131 |
}
|
151 |
|
152 |
if ( 'percentage' == $type ) {
|
153 |
$review .= '<span class="review-total-box"><span itemprop="review">' . $total . '</span> <i class="percentage-icon">%</i>' . '</span>';
|
154 |
+
} elseif ( 'point' == $type ) {
|
155 |
+
$review .= '<span class="review-total-box" itemprop="review">' . $total . '/'.__('10','mts-review').'</span></span>';
|
156 |
+
} else {
|
157 |
+
$review .= '<span class="review-total-box" itemprop="review">' . $total . '</span></span>';
|
158 |
}
|
159 |
|
160 |
if ( 'star' == $type ) {
|
265 |
|
266 |
|
267 |
$review .= '</div><!-- #review -->';
|
268 |
+
|
269 |
+
$review = apply_filters('wp_review_get_data', $review, $post->ID, $type, $total, $items);
|
270 |
return $review;
|
271 |
} else {
|
272 |
return '';
|
320 |
if ( 'percentage' == $type ) {
|
321 |
$review .= '<span class="review-total-box"><span itemprop="review">' . $total . '</span> <i class="percentage-icon">%</i>' . '</span>';
|
322 |
} elseif ( 'point' == $type ) {
|
323 |
+
$review .= '<span class="review-total-box" itemprop="review">' . $total . '/'.__('10','mts-review').'</span></span>';
|
324 |
} else {
|
325 |
// star
|
326 |
$review .= '<div class="review-total-star">';
|
344 |
$review .= '</div>';
|
345 |
}
|
346 |
|
347 |
+
$review = apply_filters('wp_review_show_total', $review, $post->ID, $type, $total);
|
348 |
+
|
349 |
if ($echo)
|
350 |
echo $review;
|
351 |
else
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: mythemeshop
|
|
3 |
Creator's website link: http://mythemeshop.com/
|
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:
|
7 |
Stable tag: 3.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -85,6 +85,11 @@ Please disable all plugins and check if rating is working properly. Then you can
|
|
85 |
|
86 |
== Changelog ==
|
87 |
|
|
|
|
|
|
|
|
|
|
|
88 |
= 3.0 =
|
89 |
* Major security updates
|
90 |
* New AJAXified Tab widget for Popular and Recent reviews, try it, you gonna love it.
|
3 |
Creator's website link: http://mythemeshop.com/
|
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.0
|
7 |
Stable tag: 3.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
85 |
|
86 |
== Changelog ==
|
87 |
|
88 |
+
= 3.1 =
|
89 |
+
* Fixed average star rating number issue.
|
90 |
+
* Added New filter to exclude post types.
|
91 |
+
* Updated filter list.
|
92 |
+
|
93 |
= 3.0 =
|
94 |
* Major security updates
|
95 |
* New AJAXified Tab widget for Popular and Recent reviews, try it, you gonna love it.
|
wp-review.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: WP Review
|
4 |
* Plugin URI: http://mythemeshop.com/
|
5 |
* Description: Easily create custom review content.
|
6 |
-
* Version: 3.
|
7 |
* Author: MyThemesShop
|
8 |
* Author URI: http://mythemeshop.com/
|
9 |
*
|
3 |
* Plugin Name: WP Review
|
4 |
* Plugin URI: http://mythemeshop.com/
|
5 |
* Description: Easily create custom review content.
|
6 |
+
* Version: 3.1
|
7 |
* Author: MyThemesShop
|
8 |
* Author URI: http://mythemeshop.com/
|
9 |
*
|