A basic plugin to display testimonials. See shortcode examples below.
- Show one specific testimonial:
[testimonial id="1"]; use the post ID as theidparameter - Show only 5 testimonials:
[testimonial posts_per_page="5"] - Order by date:
[testimonial orderby="date" order="desc"]; supports all the standard WordPress order parameters - Show only testimonials from a given category:
[testimonial tax_taxonomy="post_tag" tax_field="slug" tax_terms="home-page"]; supports these standard WordPress taxonomy parameters, prefixed bytax_:taxonomy(defaults to “category”)fieldtermsoperator
- Show testimonials with full post content:
[testimonial show_content="true"] - Show nav buttons:
[testimonial show_paging="true"] - Show stars:
[testimonial show_stars="true"] - Show ratings:
[testimonial show_rating="true"]
By default, the show_star parameter loads the dashicons stylesheet. Add this to your theme’s functions.php to prevent dashicons from loading:
add_filter( 'simple_testimonials_enqueue_dashicons', '__return_false' );
The filter simple_testimonials_star_html can be used to change the star HTML content (e.g., using an image, a different class, etc.). This string will be printed once for each star. For example:
/**
* Modifies testimonial star HTML.
*
* @param {string} $content Default star HTML.
*
* @return {string} Modified star HTML.
*/
function my_custom_star_html( $content ) {
$content = '<img src="star.png" alt="star" />';
return $content;
}
add_filter( 'simple_testimonials_star_html', 'my_custom_star_html' );
The filter simple_testimonials_author_html can be used to modify the author line. For example:
/**
* Modifies testimonial author HTML.
*
* @param {string} $content Default author HTML.
* @param {string} $author Author name.
*
* @return {string} Modified author HTML.
*/
function my_custom_author_html( $content, $author ) {
$content = '<p class="author modified">Testimonial by ' . esc_attr( $author ) . '</p>';
return $content;
}
add_filter( 'simple_testimonials_author_html', 'my_custom_author_html', 10, 2 );
Several action hooks are available:
simple_testimonials_before_posts: runs inside the wrapper before any testimonials are displayedsimple_testimonials_after_posts: runs inside the wrapper after all testimonials are displayedsimple_testimonials_no_posts: runs if no testimonials were found; passes the$shortcode_attsarray
- Add action hooks.
- Add
simple_testimonials_author_htmlfilter.
- Fix some bugs with the
offsetparameter.
- Add length taxonomy
- Add
wrapper_classshortcode parameter
- Add star rating
- Fix content being output too early
- Remove duplicate rating section
- Correctly parse all input arguments
- Convert to class-based plugin
- Add rating taxonomy and
show_ratingshortcode parameter - Add
.testimonials.shortcodewrapper to the entire shortcode block
- Add
show_pagingparameter
- Add wrapping
<article>to each testimonial
- Add support for
show_contentparameter
- Add support for
order,orderby,posts_per_page, andtaxonomyparameters
- Improve output display
- Initial plugin