Version Description
- Shortcode added - Thank you Hal Gatewood
Download this release
Release Info
Developer | comprock |
Plugin | Testimonials Widget |
Version | 0.2.4 |
Comparing to | |
See all releases |
Code changes from version 0.2.3 to 0.2.4
- readme.txt +34 -5
- screenshot-6.png +0 -0
- screenshot-7.png +0 -0
- testimonials-widget.php +117 -42
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== Testimonials Widget ===
|
2 |
Contributors: comprock, j0hnsmith
|
3 |
-
Donate link:
|
4 |
-
Tags: testimonials, quotes, quotations, random quote, sidebar, widget
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.3.1
|
7 |
-
Stable tag: 0.2.
|
8 |
|
9 |
Testimonials widget plugin allows you display testimonials in a widget on your WordPress blog.
|
10 |
|
@@ -34,6 +34,19 @@ You can make a simple client or portfolio rotator by using the testimonial field
|
|
34 |
* Allows for multiple widgets. Useful for using tags to keep widgets separated.
|
35 |
* Compatible with WordPress 3.0 multi-site functionality.
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
= Need More Power? =
|
38 |
Check out the [Quotes Collection](http://wordpress.org/extend/plugins/quotes-collection/) plugin by [SriniG](http://profiles.wordpress.org/users/SriniG/profile/public/)
|
39 |
|
@@ -45,17 +58,25 @@ Check out the [Quotes Collection](http://wordpress.org/extend/plugins/quotes-col
|
|
45 |
|
46 |
== Frequently Asked Questions ==
|
47 |
|
|
|
|
|
|
|
|
|
48 |
= I'm not seeing any testimonials but the title =
|
49 |
|
50 |
If you're not seeing any testimonials, even when not using tags filter, you might try increasing the Character limit or setting it to '0' or 'none' in the widget box.
|
51 |
|
|
|
|
|
|
|
|
|
52 |
= How to stop testimonial text/author/source being cut off? =
|
53 |
|
54 |
Specify a larger minimum height in the testimonials widget, see screenshot 2.
|
55 |
|
56 |
= How to get rid of the quotation marks that surround the random quote? =
|
57 |
|
58 |
-
Open the testimonials-widget.css file that comes along with the plugin, scroll down and look towards the bottom.
|
59 |
|
60 |
= How to change the random quote text color? =
|
61 |
|
@@ -72,6 +93,8 @@ Change the value of the variable `$testimonialswidget_admin_userlevel` on line 3
|
|
72 |
3. 'Testimonials' widget options (WordPress 3.2)
|
73 |
4. A testimonial in the sidebar
|
74 |
5. Edit testimonial
|
|
|
|
|
75 |
|
76 |
|
77 |
== Installation ==
|
@@ -87,6 +110,12 @@ Change the value of the variable `$testimonialswidget_admin_userlevel` on line 3
|
|
87 |
= trunk =
|
88 |
-
|
89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
= 0.2.3 =
|
91 |
* Allow testimonials to have multiple tags
|
92 |
* Show only quotes with all tags
|
@@ -106,4 +135,4 @@ Change the value of the variable `$testimonialswidget_admin_userlevel` on line 3
|
|
106 |
* initial release
|
107 |
|
108 |
== TODO ==
|
109 |
-
*
|
1 |
=== Testimonials Widget ===
|
2 |
Contributors: comprock, j0hnsmith
|
3 |
+
Donate link: http://typo3vagabond.com/about-typo3-vagabond/donate/
|
4 |
+
Tags: testimonial, testimonials, quote, quotes, quotations, random quote, sidebar, widget
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.3.1
|
7 |
+
Stable tag: 0.2.4
|
8 |
|
9 |
Testimonials widget plugin allows you display testimonials in a widget on your WordPress blog.
|
10 |
|
34 |
* Allows for multiple widgets. Useful for using tags to keep widgets separated.
|
35 |
* Compatible with WordPress 3.0 multi-site functionality.
|
36 |
|
37 |
+
= Shortcode [[testimonialswidget_list]] =
|
38 |
+
* Options
|
39 |
+
* hide_author - default show; hide_author=true
|
40 |
+
* hide_source - default show; hide_source=true
|
41 |
+
* ids - default none; ids=2 or ids="2,4,6"
|
42 |
+
* limit - default no limit; limit=10
|
43 |
+
* random - default newest first; random=true
|
44 |
+
* tags - default none; tags=fire or tags="fire,water"
|
45 |
+
* [[testimonialswidget_list]] Examples
|
46 |
+
* [[testimonialswidget_list hide_author=true hide_source=true]]
|
47 |
+
* [[testimonialswidget_list tags="test,fun" limit=1]]
|
48 |
+
* [[testimonialswidget_list ids=1]]
|
49 |
+
|
50 |
= Need More Power? =
|
51 |
Check out the [Quotes Collection](http://wordpress.org/extend/plugins/quotes-collection/) plugin by [SriniG](http://profiles.wordpress.org/users/SriniG/profile/public/)
|
52 |
|
58 |
|
59 |
== Frequently Asked Questions ==
|
60 |
|
61 |
+
= Testimonials widget is not showing up =
|
62 |
+
|
63 |
+
The usual problem is that jQuery is included twice. Once by WordPress and again by a theme. Remove the jQuery version included by your theme and you should be fine.
|
64 |
+
|
65 |
= I'm not seeing any testimonials but the title =
|
66 |
|
67 |
If you're not seeing any testimonials, even when not using tags filter, you might try increasing the Character limit or setting it to '0' or 'none' in the widget box.
|
68 |
|
69 |
+
= How do I apply custom CSS to a testimonial widget? =
|
70 |
+
|
71 |
+
The easiest thing is to check the source code of your page with the widget and look for the testimonial widgets div container id tag. It'll be something like `id="testimonials_widget-3"`.
|
72 |
+
|
73 |
= How to stop testimonial text/author/source being cut off? =
|
74 |
|
75 |
Specify a larger minimum height in the testimonials widget, see screenshot 2.
|
76 |
|
77 |
= How to get rid of the quotation marks that surround the random quote? =
|
78 |
|
79 |
+
Open the testimonials-widget.css file that comes along with the plugin, scroll down and look towards the bottom for the comment "Uncomment the block below if you want to get rid of the quotation marks before and after the quote".
|
80 |
|
81 |
= How to change the random quote text color? =
|
82 |
|
93 |
3. 'Testimonials' widget options (WordPress 3.2)
|
94 |
4. A testimonial in the sidebar
|
95 |
5. Edit testimonial
|
96 |
+
6. Testimonial shortcode results
|
97 |
+
7. Testimonial shortcode in post
|
98 |
|
99 |
|
100 |
== Installation ==
|
110 |
= trunk =
|
111 |
-
|
112 |
|
113 |
+
= 0.2.5 =
|
114 |
+
* nl2br enabled
|
115 |
+
|
116 |
+
= 0.2.4 =
|
117 |
+
* Shortcode added - Thank you Hal Gatewood
|
118 |
+
|
119 |
= 0.2.3 =
|
120 |
* Allow testimonials to have multiple tags
|
121 |
* Show only quotes with all tags
|
135 |
* initial release
|
136 |
|
137 |
== TODO ==
|
138 |
+
* No nl2br when content is already using HTML
|
screenshot-6.png
ADDED
Binary file
|
screenshot-7.png
ADDED
Binary file
|
testimonials-widget.php
CHANGED
@@ -2,33 +2,35 @@
|
|
2 |
/*
|
3 |
Plugin Name: Testimonials Widget
|
4 |
Description: Testimonial widget plugin helps you display testimonials in a sidebar on your WordPress blog.
|
5 |
-
Version: 0.2.
|
6 |
-
Author:
|
|
|
7 |
License: GPL2
|
8 |
-
*/
|
9 |
|
10 |
-
/* Copyright
|
|
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
*/
|
26 |
|
27 |
/* This plugin borrows code from the Quotes Collection plugin by Srini G
|
28 |
-
|
29 |
|
30 |
-
|
31 |
-
*/
|
32 |
|
33 |
|
34 |
/* Refer http://codex.wordpress.org/Roles_and_Capabilities */
|
@@ -44,7 +46,7 @@ require_once('testimonials-widget-admin.php');
|
|
44 |
function testimonialswidget_display_testimonials($title = '', $random = 1, $min_height, $refresh_interval = 10, $show_source = 0, $show_author = 1, $tags = '', $char_limit = 500, $widget_number = '', $tags_all = 0) {
|
45 |
$conditions = " WHERE public = 'yes'";
|
46 |
|
47 |
-
if(char_limit && is_numeric($char_limit)) {
|
48 |
$conditions .= " AND CHAR_LENGTH(testimonial) <= ".$char_limit;
|
49 |
} else {
|
50 |
$options['char_limit'] = 0;
|
@@ -90,7 +92,7 @@ function testimonialswidget_display_testimonials($title = '', $random = 1, $min_
|
|
90 |
EOF;
|
91 |
if ( 0 != $refresh_interval ) {
|
92 |
$html .= <<<EOF
|
93 |
-
|
94 |
function nextTestimonial$widget_number() {
|
95 |
if (!jQuery('.$id_base').first().hasClass('hovered')) {
|
96 |
var active = jQuery('.$id_base .testimonialswidget_active');
|
@@ -107,7 +109,7 @@ EOF;
|
|
107 |
jQuery('.$id_base').hover(function() { jQuery(this).addClass('hovered') }, function() { jQuery(this).removeClass('hovered') });
|
108 |
setInterval('nextTestimonial$widget_number()', $refresh_interval * 1000);
|
109 |
});
|
110 |
-
|
111 |
EOF;
|
112 |
}
|
113 |
|
@@ -141,8 +143,7 @@ EOF;
|
|
141 |
}
|
142 |
|
143 |
|
144 |
-
function testimonialswidget_get_testimonials($conditions = '')
|
145 |
-
{
|
146 |
global $wpdb;
|
147 |
$sql = "SELECT testimonial_id, testimonial, author, source, tags, public
|
148 |
FROM " . $wpdb->prefix . "testimonialswidget"
|
@@ -155,8 +156,7 @@ function testimonialswidget_get_testimonials($conditions = '')
|
|
155 |
}
|
156 |
|
157 |
|
158 |
-
function testimonialswidget_install()
|
159 |
-
{
|
160 |
global $wpdb;
|
161 |
$table_name = $wpdb->prefix . "testimonialswidget";
|
162 |
|
@@ -168,19 +168,19 @@ function testimonialswidget_install()
|
|
168 |
|
169 |
// if table name already exists
|
170 |
if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name) {
|
171 |
-
|
172 |
|
173 |
-
|
174 |
|
175 |
-
|
176 |
|
177 |
-
|
178 |
|
179 |
-
|
180 |
-
|
181 |
}
|
182 |
-
|
183 |
-
|
184 |
}
|
185 |
}
|
186 |
else {
|
@@ -195,7 +195,7 @@ function testimonialswidget_install()
|
|
195 |
time_added datetime NOT NULL,
|
196 |
time_updated datetime,
|
197 |
PRIMARY KEY (testimonial_id)
|
198 |
-
|
199 |
$results = $wpdb->query( $sql );
|
200 |
}
|
201 |
|
@@ -207,16 +207,13 @@ function testimonialswidget_install()
|
|
207 |
}
|
208 |
|
209 |
|
210 |
-
function testimonialswidget_css_head()
|
211 |
-
|
212 |
-
?>
|
213 |
<link rel="stylesheet" type="text/css" href="<?php echo plugins_url(); ?>/testimonials-widget/testimonials-widget.css" />
|
214 |
-
|
215 |
}
|
216 |
|
217 |
-
|
218 |
-
function testimonialswidget_enqueue_scripts()
|
219 |
-
{
|
220 |
wp_enqueue_script('jquery');
|
221 |
}
|
222 |
|
@@ -231,4 +228,82 @@ function testimonialswidget_init() {
|
|
231 |
|
232 |
add_action('init', 'testimonialswidget_init');
|
233 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
?>
|
2 |
/*
|
3 |
Plugin Name: Testimonials Widget
|
4 |
Description: Testimonial widget plugin helps you display testimonials in a sidebar on your WordPress blog.
|
5 |
+
Version: 0.2.4
|
6 |
+
Author: Michael Cannon
|
7 |
+
Author URI: http://typo3vagabond.com/about-typo3-vagabond/hire-michael/
|
8 |
License: GPL2
|
9 |
+
*/
|
10 |
|
11 |
+
/* Copyright 2012 Michael Cannon
|
12 |
+
Copyright 2011 j0hnsmith
|
13 |
|
14 |
+
This program is free software; you can redistribute it and/or modify
|
15 |
+
it under the terms of the GNU General Public License as published by
|
16 |
+
the Free Software Foundation; either version 2 of the License, or
|
17 |
+
(at your option) any later version.
|
18 |
|
19 |
+
This program is distributed in the hope that it will be useful,
|
20 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
+
GNU General Public License for more details.
|
23 |
|
24 |
+
You should have received a copy of the GNU General Public License
|
25 |
+
along with this program; if not, write to the Free Software
|
26 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
+
*/
|
28 |
|
29 |
/* This plugin borrows code from the Quotes Collection plugin by Srini G
|
30 |
+
http://srinig.com/wordpress/plugins/quotes-collection/
|
31 |
|
32 |
+
Additional contributions from comprock and ChrisCree
|
33 |
+
*/
|
34 |
|
35 |
|
36 |
/* Refer http://codex.wordpress.org/Roles_and_Capabilities */
|
46 |
function testimonialswidget_display_testimonials($title = '', $random = 1, $min_height, $refresh_interval = 10, $show_source = 0, $show_author = 1, $tags = '', $char_limit = 500, $widget_number = '', $tags_all = 0) {
|
47 |
$conditions = " WHERE public = 'yes'";
|
48 |
|
49 |
+
if($char_limit && is_numeric($char_limit)) {
|
50 |
$conditions .= " AND CHAR_LENGTH(testimonial) <= ".$char_limit;
|
51 |
} else {
|
52 |
$options['char_limit'] = 0;
|
92 |
EOF;
|
93 |
if ( 0 != $refresh_interval ) {
|
94 |
$html .= <<<EOF
|
95 |
+
<script type="text/javascript">
|
96 |
function nextTestimonial$widget_number() {
|
97 |
if (!jQuery('.$id_base').first().hasClass('hovered')) {
|
98 |
var active = jQuery('.$id_base .testimonialswidget_active');
|
109 |
jQuery('.$id_base').hover(function() { jQuery(this).addClass('hovered') }, function() { jQuery(this).removeClass('hovered') });
|
110 |
setInterval('nextTestimonial$widget_number()', $refresh_interval * 1000);
|
111 |
});
|
112 |
+
</script>
|
113 |
EOF;
|
114 |
}
|
115 |
|
143 |
}
|
144 |
|
145 |
|
146 |
+
function testimonialswidget_get_testimonials($conditions = '') {
|
|
|
147 |
global $wpdb;
|
148 |
$sql = "SELECT testimonial_id, testimonial, author, source, tags, public
|
149 |
FROM " . $wpdb->prefix . "testimonialswidget"
|
156 |
}
|
157 |
|
158 |
|
159 |
+
function testimonialswidget_install() {
|
|
|
160 |
global $wpdb;
|
161 |
$table_name = $wpdb->prefix . "testimonialswidget";
|
162 |
|
168 |
|
169 |
// if table name already exists
|
170 |
if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name) {
|
171 |
+
$wpdb->query("ALTER TABLE `{$table_name}` {$db_charset} {$db_collate}");
|
172 |
|
173 |
+
$wpdb->query("ALTER TABLE `{$table_name}` MODIFY testimonial TEXT {$db_charset} {$db_collate}");
|
174 |
|
175 |
+
$wpdb->query("ALTER TABLE `{$table_name}` MODIFY author VARCHAR(255) {$db_charset} {$db_collate}");
|
176 |
|
177 |
+
$wpdb->query("ALTER TABLE `{$table_name}` MODIFY source VARCHAR(255) {$db_charset} {$db_collate}");
|
178 |
|
179 |
+
if(!($wpdb->get_results("SHOW COLUMNS FROM {$table_name} LIKE 'tags'"))) {
|
180 |
+
$wpdb->query("ALTER TABLE `{$table_name}` ADD `tags` VARCHAR(255) {$db_charset} {$db_collate} AFTER `source`");
|
181 |
}
|
182 |
+
if(!($wpdb->get_results("SHOW COLUMNS FROM {$table_name} LIKE 'public'"))) {
|
183 |
+
$wpdb->query("ALTER TABLE `{$table_name}` CHANGE `visible` `public` enum('yes', 'no') DEFAULT 'yes' NOT NULL");
|
184 |
}
|
185 |
}
|
186 |
else {
|
195 |
time_added datetime NOT NULL,
|
196 |
time_updated datetime,
|
197 |
PRIMARY KEY (testimonial_id)
|
198 |
+
) {$db_charset} {$db_collate};";
|
199 |
$results = $wpdb->query( $sql );
|
200 |
}
|
201 |
|
207 |
}
|
208 |
|
209 |
|
210 |
+
function testimonialswidget_css_head() {
|
211 |
+
?>
|
|
|
212 |
<link rel="stylesheet" type="text/css" href="<?php echo plugins_url(); ?>/testimonials-widget/testimonials-widget.css" />
|
213 |
+
<?php
|
214 |
}
|
215 |
|
216 |
+
function testimonialswidget_enqueue_scripts() {
|
|
|
|
|
217 |
wp_enqueue_script('jquery');
|
218 |
}
|
219 |
|
228 |
|
229 |
add_action('init', 'testimonialswidget_init');
|
230 |
|
231 |
+
function testimonialswidget_list_shortcode($atts, $content = null) {
|
232 |
+
$ids = ($atts['ids']) ? $atts['ids'] : false;
|
233 |
+
$limit = ($atts['limit']) ? $atts['limit'] : false;
|
234 |
+
$random = ($atts['random']) ? true : false;
|
235 |
+
$show_author = ($atts['hide_author']) ? false : true;
|
236 |
+
$show_source = ($atts['hide_source']) ? false : true;
|
237 |
+
$tags = ($atts['tags']) ? $atts['tags'] : false;
|
238 |
+
|
239 |
+
$conditions = " WHERE public = 'yes'";
|
240 |
+
|
241 |
+
if($ids) {
|
242 |
+
$idlist = explode(',', $ids);
|
243 |
+
$id_conditions = '';
|
244 |
+
foreach($idlist as $id) {
|
245 |
+
$id = mysql_real_escape_string(strip_tags(trim($id)));
|
246 |
+
if($id_conditions) {
|
247 |
+
$id_conditions .= ' OR ';
|
248 |
+
}
|
249 |
+
$id_conditions .= "FIND_IN_SET('{$id}', testimonial_id)";
|
250 |
+
}
|
251 |
+
$conditions .= " AND ({$id_conditions})";
|
252 |
+
}
|
253 |
+
|
254 |
+
if($tags) {
|
255 |
+
$taglist = explode(',', $tags);
|
256 |
+
$tag_conditions = '';
|
257 |
+
foreach($taglist as $tag) {
|
258 |
+
$tag = mysql_real_escape_string(strip_tags(trim($tag)));
|
259 |
+
if($tag_conditions) {
|
260 |
+
$tag_conditions .= ' OR ';
|
261 |
+
}
|
262 |
+
$tag_conditions .= "FIND_IN_SET('{$tag}', tags)";
|
263 |
+
}
|
264 |
+
$conditions .= " AND ({$tag_conditions})";
|
265 |
+
}
|
266 |
+
|
267 |
+
if($random) {
|
268 |
+
$conditions .= " ORDER BY RAND()";
|
269 |
+
} else {
|
270 |
+
$conditions .= " ORDER BY testimonial_id DESC";
|
271 |
+
}
|
272 |
+
|
273 |
+
if ( $limit )
|
274 |
+
$conditions .= " LIMIT {$limit}";
|
275 |
+
|
276 |
+
$testimonials = testimonialswidget_get_testimonials( $conditions );
|
277 |
+
|
278 |
+
$html .= '<div class="testimonialswidget_testimonials_list">';
|
279 |
+
|
280 |
+
foreach ($testimonials as $testimonial) {
|
281 |
+
$html .= '<div class="testimonialswidget_testimonial_list">';
|
282 |
+
$html .= "<p><q>". make_clickable( $testimonial['testimonial'] ) ."</q>";
|
283 |
+
|
284 |
+
$cite = '';
|
285 |
+
if($show_author && ! empty( $testimonial['author'] ) )
|
286 |
+
$cite = '<span class="testimonialswidget_author">'. make_clickable( $testimonial['author'] ) .'</span>';
|
287 |
+
|
288 |
+
if($show_source && ! empty( $testimonial['source'] ) ) {
|
289 |
+
if($cite)
|
290 |
+
$cite .= ', ';
|
291 |
+
|
292 |
+
$cite .= '<span class="testimonialswidget_source">'. make_clickable( $testimonial['source'] ) .'</span>';
|
293 |
+
}
|
294 |
+
|
295 |
+
if($cite)
|
296 |
+
$cite = " <cite>— {$cite}</cite>";
|
297 |
+
|
298 |
+
$html .= $cite."</p></div>";
|
299 |
+
}
|
300 |
+
|
301 |
+
$html .= '</div>';
|
302 |
+
|
303 |
+
return $html;
|
304 |
+
|
305 |
+
}
|
306 |
+
|
307 |
+
add_shortcode('testimonialswidget_list', 'testimonialswidget_list_shortcode');
|
308 |
+
|
309 |
?>
|