Testimonials by WooThemes - Version 1.5.0

Version Description

  • 2014-01-02.
  • Default testimonial args now filterable.
  • Schema friendly markup.
  • 'Testimonials Per Row' option added to widget.
  • UI tweaks for wp 3.8.
  • Added woothemes_testimonials_author_link_text filter.
Download this release

Release Info

Developer jameskoster
Plugin Icon wp plugin Testimonials by WooThemes
Version 1.5.0
Comparing to
See all releases

Code changes from version 1.4.1 to 1.5.0

assets/css/admin.css CHANGED
@@ -1,23 +1,3 @@
1
- #menu-posts-testimonial .wp-menu-image {
2
- background: none;
3
- background-image: url(../images/testimonials-icon.png);
4
- background-position: 7px -132px !important;
5
- background-repeat: no-repeat;
6
- }
7
- #menu-posts-testimonial.wp-menu-open .wp-menu-image,
8
- #menu-posts-testimonial:hover .wp-menu-image {
9
- background-position: 7px -164px !important;
10
- }
11
- #icon-edit.icon32-posts-testimonial {
12
- background: transparent url(../images/testimonials-icon.png) no-repeat 0 0;
13
- }
14
- @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min--moz-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2) {
15
- #menu-posts-testimonial .wp-menu-image {
16
- background-image: url(../images/testimonials-icon@x2.png);
17
- background-size: 32px 187px;
18
- }
19
- #icon-edit.icon32-posts-testimonial {
20
- background-image: url(../images/testimonials-icon@x2.png);
21
- background-size: 32px 187px;
22
- }
23
- }
1
+ #adminmenu .menu-icon-testimonial div.wp-menu-image:before {
2
+ content: '\f122';
3
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/css/admin.less CHANGED
@@ -1,37 +1,4 @@
1
- // Features icon
2
- #menu-posts-testimonial {
3
- .wp-menu-image {
4
- background: none;
5
- background-image: url(../images/testimonials-icon.png);
6
- background-position: 7px -132px !important;
7
- background-repeat: no-repeat;
8
- }
9
- }
10
-
11
- #menu-posts-testimonial.wp-menu-open, #menu-posts-testimonial:hover {
12
- .wp-menu-image {
13
- background-position: 7px -164px !important;
14
- }
15
- }
16
-
17
- #icon-edit.icon32-posts-testimonial {
18
- background: transparent url(../images/testimonials-icon.png) no-repeat 0 0;
19
- }
20
-
21
- // Retina
22
- @media only screen and (-webkit-min-device-pixel-ratio: 2),
23
- only screen and ( min--moz-device-pixel-ratio: 2),
24
- only screen and ( -o-min-device-pixel-ratio: 2/1),
25
- only screen and ( min-device-pixel-ratio: 2),
26
- {
27
- #menu-posts-testimonial {
28
- .wp-menu-image {
29
- background-image: url(../images/testimonials-icon@x2.png);
30
- background-size: 32px 187px;
31
- }
32
- }
33
- #icon-edit.icon32-posts-testimonial {
34
- background-image: url(../images/testimonials-icon@x2.png);
35
- background-size: 32px 187px;
36
- }
37
  }
1
+ // Team members icon
2
+ #adminmenu .menu-icon-testimonial div.wp-menu-image:before {
3
+ content: '\f122';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  }
classes/class-woothemes-testimonials-taxonomy.php CHANGED
@@ -81,7 +81,17 @@ class Woothemes_Testimonials_Taxonomy {
81
  * @return array Default arguments.
82
  */
83
  private function _get_default_args () {
84
- return array( 'labels' => $this->_get_default_labels(), 'public' => true, 'hierarchical' => true, 'show_ui' => true, 'show_admin_column' => true, 'query_var' => true, 'show_in_nav_menus' => false, 'show_tagcloud' => false );
 
 
 
 
 
 
 
 
 
 
85
  } // End _get_default_args()
86
 
87
  /**
@@ -116,4 +126,4 @@ class Woothemes_Testimonials_Taxonomy {
116
  register_taxonomy( esc_attr( $this->token ), esc_attr( $this->post_type ), (array)$this->args );
117
  } // End register()
118
  } // End Class
119
- ?>
81
  * @return array Default arguments.
82
  */
83
  private function _get_default_args () {
84
+ return array(
85
+ 'labels' => $this->_get_default_labels(),
86
+ 'public' => true,
87
+ 'hierarchical' => true,
88
+ 'show_ui' => true,
89
+ 'show_admin_column' => true,
90
+ 'query_var' => true,
91
+ 'show_in_nav_menus' => false,
92
+ 'show_tagcloud' => false,
93
+ 'rewrite' => array( 'slug' => 'testimonials', 'with_front' => false ),
94
+ );
95
  } // End _get_default_args()
96
 
97
  /**
126
  register_taxonomy( esc_attr( $this->token ), esc_attr( $this->post_type ), (array)$this->args );
127
  } // End register()
128
  } // End Class
129
+ ?>
classes/class-woothemes-widget-testimonials.php CHANGED
@@ -38,10 +38,10 @@ class Woothemes_Widget_Testimonials extends WP_Widget {
38
  */
39
  public function __construct() {
40
  /* Widget variable settings. */
41
- $this->woothemes_widget_cssclass = 'widget_woothemes_testimonials';
42
  $this->woothemes_widget_description = __( 'Recent testimonials on your site.', 'woothemes-testimonials' );
43
- $this->woothemes_widget_idbase = 'woothemes_testimonials';
44
- $this->woothemes_widget_title = __( 'Testimonials', 'woothemes-testimonials' );
45
 
46
  /* Widget settings. */
47
  $widget_ops = array( 'classname' => $this->woothemes_widget_cssclass, 'description' => $this->woothemes_widget_description );
@@ -85,6 +85,7 @@ class Woothemes_Widget_Testimonials extends WP_Widget {
85
 
86
  // Integer values.
87
  if ( isset( $instance['limit'] ) && ( 0 < count( $instance['limit'] ) ) ) { $args['limit'] = intval( $instance['limit'] ); }
 
88
  if ( isset( $instance['specific_id'] ) && ( 0 < count( $instance['specific_id'] ) ) ) { $args['id'] = intval( $instance['specific_id'] ); }
89
  if ( isset( $instance['size'] ) && ( 0 < count( $instance['size'] ) ) ) { $args['size'] = intval( $instance['size'] ); }
90
  if ( isset( $instance['category'] ) && is_numeric( $instance['category'] ) ) $args['category'] = intval( $instance['category'] );
@@ -116,22 +117,23 @@ class Woothemes_Widget_Testimonials extends WP_Widget {
116
  $instance = $old_instance;
117
 
118
  /* Strip tags for title and name to remove HTML (important for text inputs). */
119
- $instance['title'] = strip_tags( $new_instance['title'] );
120
 
121
  /* Make sure the integer values are definitely integers. */
122
- $instance['limit'] = intval( $new_instance['limit'] );
123
- $instance['specific_id'] = intval( $new_instance['specific_id'] );
124
- $instance['size'] = intval( $new_instance['size'] );
125
- $instance['category'] = intval( $new_instance['category'] );
 
126
 
127
  /* The select box is returning a text value, so we escape it. */
128
- $instance['orderby'] = esc_attr( $new_instance['orderby'] );
129
- $instance['order'] = esc_attr( $new_instance['order'] );
130
 
131
  /* The checkbox is returning a Boolean (true/false), so we check for that. */
132
  $instance['display_author'] = (bool) esc_attr( $new_instance['display_author'] );
133
  $instance['display_avatar'] = (bool) esc_attr( $new_instance['display_avatar'] );
134
- $instance['display_url'] = (bool) esc_attr( $new_instance['display_url'] );
135
 
136
  return $instance;
137
  } // End update()
@@ -148,18 +150,19 @@ class Woothemes_Widget_Testimonials extends WP_Widget {
148
  /* Set up some default widget settings. */
149
  /* Make sure all keys are added here, even with empty string values. */
150
  $defaults = array(
151
- 'title' => '',
152
- 'limit' => 5,
153
- 'orderby' => 'menu_order',
154
- 'order' => 'DESC',
155
- 'specific_id' => '',
156
- 'display_author' => true,
157
- 'display_avatar' => true,
158
- 'display_url' => true,
159
- 'effect' => 'fade', // Options: 'fade', 'none'
160
- 'pagination' => false,
161
- 'size' => 50,
162
- 'category' => 0
 
163
  );
164
 
165
  $instance = wp_parse_args( (array) $instance, $defaults );
@@ -174,6 +177,11 @@ class Woothemes_Widget_Testimonials extends WP_Widget {
174
  <label for="<?php echo $this->get_field_id( 'limit' ); ?>"><?php _e( 'Limit:', 'woothemes-testimonials' ); ?></label>
175
  <input type="text" name="<?php echo $this->get_field_name( 'limit' ); ?>" value="<?php echo $instance['limit']; ?>" class="widefat" id="<?php echo $this->get_field_id( 'limit' ); ?>" />
176
  </p>
 
 
 
 
 
177
  <!-- Widget Image Size: Text Input -->
178
  <p>
179
  <label for="<?php echo $this->get_field_id( 'size' ); ?>"><?php _e( 'Image Size (in pixels):', 'woothemes-testimonials' ); ?></label>
38
  */
39
  public function __construct() {
40
  /* Widget variable settings. */
41
+ $this->woothemes_widget_cssclass = 'widget_woothemes_testimonials';
42
  $this->woothemes_widget_description = __( 'Recent testimonials on your site.', 'woothemes-testimonials' );
43
+ $this->woothemes_widget_idbase = 'woothemes_testimonials';
44
+ $this->woothemes_widget_title = __( 'Testimonials', 'woothemes-testimonials' );
45
 
46
  /* Widget settings. */
47
  $widget_ops = array( 'classname' => $this->woothemes_widget_cssclass, 'description' => $this->woothemes_widget_description );
85
 
86
  // Integer values.
87
  if ( isset( $instance['limit'] ) && ( 0 < count( $instance['limit'] ) ) ) { $args['limit'] = intval( $instance['limit'] ); }
88
+ if ( isset( $instance['per_row'] ) && ( 0 < count( $instance['per_row'] ) ) ) { $args['per_row'] = intval( $instance['per_row'] ); }
89
  if ( isset( $instance['specific_id'] ) && ( 0 < count( $instance['specific_id'] ) ) ) { $args['id'] = intval( $instance['specific_id'] ); }
90
  if ( isset( $instance['size'] ) && ( 0 < count( $instance['size'] ) ) ) { $args['size'] = intval( $instance['size'] ); }
91
  if ( isset( $instance['category'] ) && is_numeric( $instance['category'] ) ) $args['category'] = intval( $instance['category'] );
117
  $instance = $old_instance;
118
 
119
  /* Strip tags for title and name to remove HTML (important for text inputs). */
120
+ $instance['title'] = strip_tags( $new_instance['title'] );
121
 
122
  /* Make sure the integer values are definitely integers. */
123
+ $instance['limit'] = intval( $new_instance['limit'] );
124
+ $instance['per_row'] = intval( $new_instance['per_row'] );
125
+ $instance['specific_id'] = intval( $new_instance['specific_id'] );
126
+ $instance['size'] = intval( $new_instance['size'] );
127
+ $instance['category'] = intval( $new_instance['category'] );
128
 
129
  /* The select box is returning a text value, so we escape it. */
130
+ $instance['orderby'] = esc_attr( $new_instance['orderby'] );
131
+ $instance['order'] = esc_attr( $new_instance['order'] );
132
 
133
  /* The checkbox is returning a Boolean (true/false), so we check for that. */
134
  $instance['display_author'] = (bool) esc_attr( $new_instance['display_author'] );
135
  $instance['display_avatar'] = (bool) esc_attr( $new_instance['display_avatar'] );
136
+ $instance['display_url'] = (bool) esc_attr( $new_instance['display_url'] );
137
 
138
  return $instance;
139
  } // End update()
150
  /* Set up some default widget settings. */
151
  /* Make sure all keys are added here, even with empty string values. */
152
  $defaults = array(
153
+ 'title' => '',
154
+ 'limit' => 5,
155
+ 'per_row' => null,
156
+ 'orderby' => 'menu_order',
157
+ 'order' => 'DESC',
158
+ 'specific_id' => '',
159
+ 'display_author' => true,
160
+ 'display_avatar' => true,
161
+ 'display_url' => true,
162
+ 'effect' => 'fade', // Options: 'fade', 'none'
163
+ 'pagination' => false,
164
+ 'size' => 50,
165
+ 'category' => 0,
166
  );
167
 
168
  $instance = wp_parse_args( (array) $instance, $defaults );
177
  <label for="<?php echo $this->get_field_id( 'limit' ); ?>"><?php _e( 'Limit:', 'woothemes-testimonials' ); ?></label>
178
  <input type="text" name="<?php echo $this->get_field_name( 'limit' ); ?>" value="<?php echo $instance['limit']; ?>" class="widefat" id="<?php echo $this->get_field_id( 'limit' ); ?>" />
179
  </p>
180
+ <!-- Widget Per Row: Text Input -->
181
+ <p>
182
+ <label for="<?php echo $this->get_field_id( 'per_row' ); ?>"><?php _e( 'Testimonials Per Row:', 'woothemes-testimonials' ); ?></label>
183
+ <input type="text" name="<?php echo $this->get_field_name( 'per_row' ); ?>" value="<?php echo $instance['per_row']; ?>" class="widefat" id="<?php echo $this->get_field_id( 'per_row' ); ?>" />
184
+ </p>
185
  <!-- Widget Image Size: Text Input -->
186
  <p>
187
  <label for="<?php echo $this->get_field_id( 'size' ); ?>"><?php _e( 'Image Size (in pixels):', 'woothemes-testimonials' ); ?></label>
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: woothemes, mattyza, jameskoster
3
  Donate link: http://woothemes.com/
4
  Tags: testimonials, widget, shortcode, template-tag, feedback, customers
5
  Requires at least: 3.4.2
6
- Tested up to: 3.6.0
7
- Stable tag: 1.4.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -130,6 +130,14 @@ We encourage everyone to contribute their ideas, thoughts and code snippets. Thi
130
 
131
  == Changelog ==
132
 
 
 
 
 
 
 
 
 
133
  = 1.4.1 =
134
  * 2013-08-22.
135
  * Fixes display of testimonials when no "id" parameter is set.
3
  Donate link: http://woothemes.com/
4
  Tags: testimonials, widget, shortcode, template-tag, feedback, customers
5
  Requires at least: 3.4.2
6
+ Tested up to: 3.8.0
7
+ Stable tag: 1.5.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
130
 
131
  == Changelog ==
132
 
133
+ = 1.5.0 =
134
+ * 2014-01-02.
135
+ * Default testimonial args now filterable.
136
+ * Schema friendly markup.
137
+ * 'Testimonials Per Row' option added to widget.
138
+ * UI tweaks for wp 3.8.
139
+ * Added woothemes_testimonials_author_link_text filter.
140
+
141
  = 1.4.1 =
142
  * 2013-08-22.
143
  * Fixes display of testimonials when no "id" parameter is set.
woothemes-testimonials-template.php CHANGED
@@ -3,7 +3,7 @@ if ( ! defined( 'ABSPATH' ) ) exit;
3
 
4
  if ( ! function_exists( 'woothemes_get_testimonials' ) ) {
5
  /**
6
- * Wrapper function to get the testimonials from the WooDojo_Testimonials class.
7
  * @param string/array $args Arguments.
8
  * @since 1.0.0
9
  * @return array/boolean Array if true, boolean if false.
@@ -31,26 +31,26 @@ if ( ! function_exists( 'woothemes_testimonials' ) ) {
31
  function woothemes_testimonials ( $args = '' ) {
32
  global $post;
33
 
34
- $defaults = array(
35
- 'limit' => 5,
36
- 'per_row' => null,
37
- 'orderby' => 'menu_order',
38
- 'order' => 'DESC',
39
- 'id' => 0,
40
- 'display_author' => true,
41
- 'display_avatar' => true,
42
- 'display_url' => true,
43
- 'effect' => 'fade', // Options: 'fade', 'none'
44
- 'pagination' => false,
45
- 'echo' => true,
46
- 'size' => 50,
47
- 'title' => '',
48
- 'before' => '<div class="widget widget_woothemes_testimonials">',
49
- 'after' => '</div>',
50
- 'before_title' => '<h2>',
51
- 'after_title' => '</h2>',
52
- 'category' => 0
53
- );
54
 
55
  $args = wp_parse_args( $args, $defaults );
56
 
@@ -85,7 +85,7 @@ function woothemes_testimonials ( $args = '' ) {
85
  $html .= '<div class="testimonials-list">' . "\n";
86
 
87
  // Begin templating logic.
88
- $tpl = '<div id="quote-%%ID%%" class="%%CLASS%%"><blockquote class="testimonials-text">%%TEXT%%</blockquote>%%AVATAR%% %%AUTHOR%%<div class="fix"></div></div>';
89
  $tpl = apply_filters( 'woothemes_testimonials_item_template', $tpl, $args );
90
 
91
  $count = 0;
@@ -108,18 +108,18 @@ function woothemes_testimonials ( $args = '' ) {
108
 
109
  // If we need to display the author, get the data.
110
  if ( ( get_the_title( $post ) != '' ) && true == $args['display_author'] ) {
111
- $author .= '<cite class="author">';
112
 
113
- $author_name = get_the_title( $post );
114
 
115
  $author .= $author_name;
116
 
117
  if ( isset( $post->byline ) && '' != $post->byline ) {
118
- $author .= ' <span class="excerpt">' . $post->byline . '</span><!--/.excerpt-->' . "\n";
119
  }
120
 
121
  if ( true == $args['display_url'] && '' != $post->url ) {
122
- $author .= ' <span class="url"><a href="' . esc_url( $post->url ) . '">' . $post->url . '</a></span><!--/.excerpt-->' . "\n";
123
  }
124
 
125
  $author .= '</cite><!--/.author-->' . "\n";
@@ -192,19 +192,19 @@ function woothemes_testimonials_shortcode ( $atts, $content = null ) {
192
  $args = (array)$atts;
193
 
194
  $defaults = array(
195
- 'limit' => 5,
196
- 'per_row' => null,
197
- 'orderby' => 'menu_order',
198
- 'order' => 'DESC',
199
- 'id' => 0,
200
- 'display_author' => true,
201
- 'display_avatar' => true,
202
- 'display_url' => true,
203
- 'effect' => 'fade', // Options: 'fade', 'none'
204
- 'pagination' => false,
205
- 'echo' => true,
206
- 'size' => 50,
207
- 'category' => 0
208
  );
209
 
210
  $args = shortcode_atts( $defaults, $atts );
@@ -243,5 +243,4 @@ function woothemes_testimonials_content_default_filters () {
243
  } // End woothemes_testimonials_content_default_filters()
244
 
245
  add_action( 'woothemes_testimonials_before', 'woothemes_testimonials_content_default_filters' );
246
- }
247
- ?>
3
 
4
  if ( ! function_exists( 'woothemes_get_testimonials' ) ) {
5
  /**
6
+ * Wrapper function to get the testimonials from the WooThemes_Testimonials class.
7
  * @param string/array $args Arguments.
8
  * @since 1.0.0
9
  * @return array/boolean Array if true, boolean if false.
31
  function woothemes_testimonials ( $args = '' ) {
32
  global $post;
33
 
34
+ $defaults = apply_filters( 'woothemes_testimonials_default_args', array(
35
+ 'limit' => 5,
36
+ 'per_row' => null,
37
+ 'orderby' => 'menu_order',
38
+ 'order' => 'DESC',
39
+ 'id' => 0,
40
+ 'display_author' => true,
41
+ 'display_avatar' => true,
42
+ 'display_url' => true,
43
+ 'effect' => 'fade', // Options: 'fade', 'none'
44
+ 'pagination' => false,
45
+ 'echo' => true,
46
+ 'size' => 50,
47
+ 'title' => '',
48
+ 'before' => '<div class="widget widget_woothemes_testimonials">',
49
+ 'after' => '</div>',
50
+ 'before_title' => '<h2>',
51
+ 'after_title' => '</h2>',
52
+ 'category' => 0,
53
+ ) );
54
 
55
  $args = wp_parse_args( $args, $defaults );
56
 
85
  $html .= '<div class="testimonials-list">' . "\n";
86
 
87
  // Begin templating logic.
88
+ $tpl = '<div id="quote-%%ID%%" class="%%CLASS%%" itemprop="review" itemscope itemtype="http://schema.org/Review"><blockquote class="testimonials-text" itemprop="reviewBody">%%TEXT%%</blockquote>%%AVATAR%% %%AUTHOR%%</div>';
89
  $tpl = apply_filters( 'woothemes_testimonials_item_template', $tpl, $args );
90
 
91
  $count = 0;
108
 
109
  // If we need to display the author, get the data.
110
  if ( ( get_the_title( $post ) != '' ) && true == $args['display_author'] ) {
111
+ $author .= '<cite class="author" itemprop="author" itemscope itemtype="http://schema.org/Person">';
112
 
113
+ $author_name = '<span itemprop="name">' . get_the_title( $post ) . '</span>';
114
 
115
  $author .= $author_name;
116
 
117
  if ( isset( $post->byline ) && '' != $post->byline ) {
118
+ $author .= ' <span class="title" itemprop="jobTitle">' . $post->byline . '</span><!--/.title-->' . "\n";
119
  }
120
 
121
  if ( true == $args['display_url'] && '' != $post->url ) {
122
+ $author .= ' <span class="url"><a href="' . esc_url( $post->url ) . '" itemprop="url">' . apply_filters( 'woothemes_testimonials_author_link_text', $text = esc_url( $post->url ) ) . '</a></span><!--/.excerpt-->' . "\n";
123
  }
124
 
125
  $author .= '</cite><!--/.author-->' . "\n";
192
  $args = (array)$atts;
193
 
194
  $defaults = array(
195
+ 'limit' => 5,
196
+ 'per_row' => null,
197
+ 'orderby' => 'menu_order',
198
+ 'order' => 'DESC',
199
+ 'id' => 0,
200
+ 'display_author' => true,
201
+ 'display_avatar' => true,
202
+ 'display_url' => true,
203
+ 'effect' => 'fade', // Options: 'fade', 'none'
204
+ 'pagination' => false,
205
+ 'echo' => true,
206
+ 'size' => 50,
207
+ 'category' => 0,
208
  );
209
 
210
  $args = shortcode_atts( $defaults, $atts );
243
  } // End woothemes_testimonials_content_default_filters()
244
 
245
  add_action( 'woothemes_testimonials_before', 'woothemes_testimonials_content_default_filters' );
246
+ }
 
woothemes-testimonials.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin URI: http://woothemes.com/
5
  * Description: Hi, I'm your testimonials management plugin for WordPress. Show off what your customers or website users are saying about your business and how great they say you are, using our shortcode, widget or template tag.
6
  * Author: WooThemes
7
- * Version: 1.4.1
8
  * Author URI: http://woothemes.com/
9
  *
10
  * @package WordPress
@@ -19,5 +19,4 @@ require_once( 'woothemes-testimonials-template.php' );
19
  require_once( 'classes/class-woothemes-widget-testimonials.php' );
20
  global $woothemes_testimonials;
21
  $woothemes_testimonials = new Woothemes_Testimonials( __FILE__ );
22
- $woothemes_testimonials->version = '1.4.1';
23
- ?>
4
  * Plugin URI: http://woothemes.com/
5
  * Description: Hi, I'm your testimonials management plugin for WordPress. Show off what your customers or website users are saying about your business and how great they say you are, using our shortcode, widget or template tag.
6
  * Author: WooThemes
7
+ * Version: 1.5.0
8
  * Author URI: http://woothemes.com/
9
  *
10
  * @package WordPress
19
  require_once( 'classes/class-woothemes-widget-testimonials.php' );
20
  global $woothemes_testimonials;
21
  $woothemes_testimonials = new Woothemes_Testimonials( __FILE__ );
22
+ $woothemes_testimonials->version = '1.5.0';