Below, you’ll find a detailed guide on how to add the Super Testimonials Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Super Testimonials Plugin shortcodes not to show or not to work correctly.
Before starting, here is an overview of the Super Testimonials Plugin and the shortcodes it provides:
"Super Testimonials is a powerful WordPress plugin designed to display and manage your testimonials effectively. With its user-friendly interface, showcasing your clients' feedback has never been easier."
- [tptpro]
- [tpsscode]
Super Testimonials [tptpro] Shortcode
The ‘tptpro’ shortcode is part of the Super Testimonial plugin. It retrieves and displays testimonials according to the specified parameters, such as category, theme, and style. This shortcode is highly customizable, allowing you to control aspects like the number of testimonials displayed, their alignment, and even the color scheme. It uses the ‘tp_testimonial_pro_post_query’ function to query the desired testimonials based on the attributes passed.
Shortcode: [tptpro]
Parameters
Here is a list of all possible tptpro shortcode parameters and attributes:
id
– unique identifier for the testimonial post
Examples and Usage
Basic example – Display a testimonial using its post ID.
[tptpro id=1 /]
Advanced Examples
Displaying a testimonial with a specific theme by referencing the post ID and theme. The theme will be applied to the testimonial post with the given ID.
[tptpro id=1 tp_testimonial_themes=2 /]
Displaying a testimonial with a specific theme and a specific number of total items to display. The theme will be applied to the testimonial post with the given ID and only the specified number of items will be displayed.
[tptpro id=1 tp_testimonial_themes=2 dpstotoal_items=5 /]
PHP Function Code
In case you have difficulties debugging what causing issues with [tptpro]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'tptpro', 'tp_testimonial_pro_post_query' );
Shortcode PHP function:
function tp_testimonial_pro_post_query( $atts, $content = null ) {
$atts = shortcode_atts(
array(
'id' => "",
),
$atts
);
global $post, $paged, $query;
$postid = $atts['id'];
$testimonial_cat_name = get_post_meta( $postid, 'testimonial_cat_name', true );
$tp_testimonial_themes = get_post_meta( $postid, 'tp_testimonial_themes', true );
$tp_testimonial_theme_style = get_post_meta( $postid, 'tp_testimonial_theme_style', true );
$grid_normal_column = get_post_meta( $postid, 'grid_normal_column', true );
$tp_order_by_option = get_post_meta( $postid, 'tp_order_by_option', true );
$tp_testimonial_textalign = get_post_meta( $postid, 'tp_testimonial_textalign', true );
$tp_img_show_hide = get_post_meta( $postid, 'tp_img_show_hide', true );
$tp_img_border_radius = get_post_meta( $postid, 'tp_img_border_radius', true );
$tp_imgborder_width_option = get_post_meta( $postid, 'tp_imgborder_width_option', true );
$tp_imgborder_color_option = get_post_meta( $postid, 'tp_imgborder_color_option', true );
$tp_name_color_option = get_post_meta( $postid, 'tp_name_color_option', true );
$tp_name_fontsize_option = get_post_meta( $postid, 'tp_name_fontsize_option', true );
$tp_name_font_case = get_post_meta( $postid, 'tp_name_font_case', true );
$tp_name_font_style = get_post_meta( $postid, 'tp_name_font_style', true );
$tp_designation_show_hide = get_post_meta( $postid, 'tp_designation_show_hide', true );
$tp_desig_fontsize_option = get_post_meta( $postid, 'tp_desig_fontsize_option', true );
$tp_designation_color_option = get_post_meta( $postid, 'tp_designation_color_option', true );
$tp_designation_font_style = get_post_meta( $postid, 'tp_designation_font_style', true );
$tp_designation_case = get_post_meta( $postid, 'tp_designation_case', true );
$tp_company_show_hide = get_post_meta( $postid, 'tp_company_show_hide', true );
$tp_company_url_color = get_post_meta( $postid, 'tp_company_url_color', true );
$tp_content_color = get_post_meta( $postid, 'tp_content_color', true );
$tp_content_fontsize_option = get_post_meta( $postid, 'tp_content_fontsize_option', true );
$tp_content_bg_color = get_post_meta( $postid, 'tp_content_bg_color', true );
$tp_show_rating_option = get_post_meta( $postid, 'tp_show_rating_option', true );
$tp_rating_color = get_post_meta( $postid, 'tp_rating_color', true );
$tp_rating_fontsize_option = get_post_meta( $postid, 'tp_rating_fontsize_option', true );
$nav_text_color = get_post_meta( $postid, 'nav_text_color', true );
$nav_bg_color = get_post_meta( $postid, 'nav_bg_color', true );
$navigation_align = get_post_meta( $postid, 'navigation_align', true );
$pagination = get_post_meta( $postid, 'pagination', true );
$pagination_bg_color = get_post_meta( $postid, 'pagination_bg_color', true );
$pagination_align = get_post_meta( $postid, 'pagination_align', true );
$dpstotoal_items = get_post_meta( $postid, 'dpstotoal_items', true );
$item_no = get_post_meta( $postid, 'item_no', true );
$loop = get_post_meta( $postid, 'loop', true );
$margin = get_post_meta( $postid, 'margin', true );
$navigation = get_post_meta( $postid, 'navigation', true );
$pagination = get_post_meta( $postid, 'pagination', true );
$autoplay = get_post_meta( $postid, 'autoplay', true );
$autoplay_speed = get_post_meta( $postid, 'autoplay_speed', true );
$stop_hover = get_post_meta( $postid, 'stop_hover', true );
$autoplaytimeout = get_post_meta( $postid, 'autoplaytimeout', true );
$itemsdesktop = get_post_meta( $postid, 'itemsdesktop', true );
$itemsdesktopsmall = get_post_meta( $postid, 'itemsdesktopsmall', true );
$itemsmobile = get_post_meta( $postid, 'itemsmobile', true );
$filter_menu_styles = get_post_meta( $postid, 'filter_menu_styles', true );
$filter_menu_alignment = get_post_meta( $postid, 'filter_menu_alignment', true );
$filter_menu_bg_color = get_post_meta( $postid, 'filter_menu_bg_color', true );
$filter_menu_bg_color_hover = get_post_meta( $postid, 'filter_menu_bg_color_hover', true );
$filter_menu_bg_color_active = get_post_meta( $postid, 'filter_menu_bg_color_active', true );
$filter_menu_font_color = get_post_meta( $postid, 'filter_menu_font_color', true );
$filter_menu_font_color_hover = get_post_meta( $postid, 'filter_menu_font_color_hover', true );
$filter_menu_font_color_active = get_post_meta( $postid, 'filter_menu_font_color_active', true );
$nav_text_color_hover = get_post_meta( $postid, 'nav_text_color_hover', true );
$nav_bg_color_hover = get_post_meta( $postid, 'nav_bg_color_hover', true );
$pagination_bg_color_active = get_post_meta( $postid, 'pagination_bg_color_active', true );
$navigation_style = get_post_meta( $postid, 'navigation_style', true );
$pagination_style = get_post_meta( $postid, 'pagination_style', true );
$tp_item_bg_color = get_post_meta( $postid, 'tp_item_bg_color', true );
$tp_item_padding = get_post_meta( $postid, 'tp_item_padding', true );
$tp_show_item_bg_option = get_post_meta( $postid, 'tp_show_item_bg_option', true );
$args = array(
'taxonomy' => 'ktspcategory',
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => 1,
);
$cats = get_categories($args);
if ( ! empty( $testimonial_cat_name ) && ! empty( $cats ) ) {
$tpprocat = array();
$num = count( $testimonial_cat_name );
for ( $j=0; $j<$num; $j++ ) {
array_push( $tpprocat, $testimonial_cat_name[$j] );
}
$args = array(
'post_type' => 'ktsprotype',
'post_status' => 'publish',
'posts_per_page' => $dpstotoal_items,
'orderby' => $tp_order_by_option,
'tax_query' => array(
array(
'taxonomy' => 'ktspcategory',
'field' => 'id',
'terms' => $tpprocat,
)
)
);
} else {
$args = array(
'post_type' => 'ktsprotype',
'post_status' => 'publish',
'posts_per_page' => $dpstotoal_items,
'orderby' => $tp_order_by_option,
);
}
$query = new WP_Query( $args );
ob_start();
switch ( $tp_testimonial_themes ) {
case '1':
include __DIR__ . '/template/theme-1.php';
break;
case '2':
include __DIR__ . '/template/theme-2.php';
break;
case '3':
include __DIR__ . '/template/theme-3.php';
break;
case '4':
include __DIR__ . '/template/theme-4.php';
break;
case '5':
include __DIR__ . '/template/theme-5.php';
break;
// case '6':
// include __DIR__ . '/template/theme-6.php';
// break;
// case '7':
// include __DIR__ . '/template/theme-7.php';
// break;
// case '8':
// include __DIR__ . '/template/theme-8.php';
// break;
// case '9':
// include __DIR__ . '/template/theme-9.php';
// break;
// case '10':
// include __DIR__ . '/template/theme-10.php';
// break;
// case '11':
// include __DIR__ . '/template/theme-11.php';
// break;
// case '12':
// include __DIR__ . '/template/theme-12.php';
// break;
// case '13':
// include __DIR__ . '/template/theme-13.php';
// break;
// case '14':
// include __DIR__ . '/template/theme-14.php';
// break;
// case '15':
// include __DIR__ . '/template/theme-15.php';
// break;
// case '16':
// include __DIR__ . '/template/theme-16.php';
// break;
// case '17':
// include __DIR__ . '/template/theme-17.php';
// break;
// case '18':
// include __DIR__ . '/template/theme-18.php';
// break;
// case '19':
// include __DIR__ . '/template/theme-19.php';
// break;
case '20':
include __DIR__ . '/template/theme-20.php';
break;
// case '21':
// include __DIR__ . '/template/theme-21.php';
// break;
// case '22':
// include __DIR__ . '/template/theme-22.php';
// break;
// case '23':
// include __DIR__ . '/template/theme-23.php';
// break;
// case '24':
// include __DIR__ . '/template/theme-24.php';
// break;
// case '25':
// include __DIR__ . '/template/theme-25.php';
// break;
// case '26':
// include __DIR__ . '/template/theme-26.php';
// break;
// case '27':
// include __DIR__ . '/template/theme-27.php';
// break;
// case '28':
// include __DIR__ . '/template/theme-28.php';
// break;
// case '29':
// include __DIR__ . '/template/theme-29.php';
// break;
// case '30':
// include __DIR__ . '/template/theme-30.php';
// break;
}
return ob_get_clean();
}
Code file location:
super-testimonial/super-testimonial/includes/shortcodes/tp-testimonial-pro-shortcode.php
Super Testimonials [tpsscode] Shortcode
The ‘tpsscode’ shortcode from the Super Testimonial plugin is designed to display testimonials on your WordPress site. It creates a testimonial slider with various themes, allowing customization on categories, order, and appearance.
Shortcode: [tpsscode]
Parameters
Here is a list of all possible tpsscode shortcode parameters and attributes:
category
– defines the category ID for the testimonialsthemes
– selects the theme for the testimonialscolumns_number
– sets the number of columns for the testimonialsorder_by
– sets the order of the testimonialsorder
– defines the order direction of the testimonialsnumber
– sets the number of testimonials to displayauto_play
– enables or disables autoplay for the testimonialsnavigation
– enables or disables navigation for the testimonialsstars_color
– sets the color of the testimonial starstext_color
– sets the color of the testimonial text
Examples and Usage
Basic example – Display testimonials using the default theme and settings.
[tpsscode]
Advanced examples
Display testimonials from a specific category (category id = 3), using theme2, in 3 columns, ordered by date in ascending order, and limit the number of testimonials to 5.
[tpsscode category="3" themes="theme2" columns_number="3" order_by="date" order="ASC" number="5"]
Display testimonials using theme3, with auto play turned off, navigation turned off, stars color set to red, and text color set to blue.
[tpsscode themes="theme3" auto_play="false" navigation="false" stars_color="#ff0000" text_color="#0000ff"]
Display testimonials from a specific category (category id = 2), using theme4, in 4 columns, ordered randomly, and with auto play turned on.
[tpsscode category="2" themes="theme4" columns_number="4" order_by="rand" auto_play="true"]
PHP Function Code
In case you have difficulties debugging what causing issues with [tpsscode]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode('tpsscode', 'tps_super_testimonials_shortcode_register');
Shortcode PHP function:
function tps_super_testimonials_shortcode_register($atts, $content=null) {
extract(shortcode_atts( array(
'category' => '-1',
'themes' => 'theme1',
'columns_number' => '2',
'order_by' => 'rand',
'order' => 'DESC',
'number' => '-1',
'auto_play' => 'true',
'navigation' => 'true',
'stars_color' => '#1a1a1a',
'text_color' => '#000000',
), $atts));
// query posts
$args = array (
'post_type' => 'ktsprotype',
'posts_per_page' => $number,
'orderby' => $order_by,
'order' => $order
);
if($category > -1) {
$args['tax_query'] = array(array('taxonomy' => 'ktspcategory','field' => 'id','terms' => $category ));
}
$tstrndsk = rand(1,1000);
$testimonials_query = new WP_Query( $args );
ob_start();
if( $themes=="theme1" ){ ?>
<style type="text/css">
div#testimonial-slider-<?php echo esc_attr( $themes ); ?> {
display: block;
overflow: hidden;
padding-top: 10px;
}
.testimonial-<?php echo esc_attr( $themes ); ?>{
text-align: center;
}
.testimonial-<?php echo esc_attr( $themes ); ?> .testimonial-thumb-<?php echo esc_attr( $themes ); ?>{
width: 85px;
height: 85px;
border-radius: 50%;
margin: 0 auto 40px;
border: 4px solid #eb7260;
overflow: hidden;
}
.testimonial-<?php echo esc_attr( $themes ); ?> .testimonial-thumb-<?php echo esc_attr( $themes ); ?> img{
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
.testimonial-<?php echo esc_attr( $themes ); ?> .testimonial-description-<?php echo esc_attr( $themes ); ?>{
color: <?php echo esc_attr( $text_color); ?>;
font-size: 15px;
font-style: italic;
line-height: 24px;
margin-bottom: 20px;
}
.testimonial-<?php echo esc_attr( $themes ); ?> .testimonial-description-profiles-<?php echo esc_attr( $themes ); ?>{
margin:20px 0;
text-align:center;
}
.testimonial-<?php echo esc_attr( $themes ); ?> .testimonial-description-title-<?php echo esc_attr( $themes ); ?>{
font-size: 20px;
color: #eb7260;
margin-right: 20px;
text-transform: capitalize;
}
.testimonial-<?php echo esc_attr( $themes ); ?> .testimonial-description-title-<?php echo esc_attr( $themes ); ?>:after{
content: "";
margin-left: 30px;
border-right: 1px solid #808080;
}
.testimonial-<?php echo esc_attr( $themes ); ?> .testimonial-description-profiles-<?php echo esc_attr( $themes ); ?> small{
display: inline-block;
color: #8a9aad;
font-size: 17px;
text-transform: capitalize;
}
.testimonial-<?php echo esc_attr( $themes ); ?> .testimonial-description-profiles-<?php echo esc_attr( $themes ); ?> small a, a:hover {
text-decoration: none;
box-shadow: none;
}
.testimonial-<?php echo esc_attr( $themes ); ?> .super-testimonial-<?php echo esc_attr( $themes ); ?> {
display: block;
overflow: hidden;
text-align: center;
}
.testimonial-<?php echo esc_attr( $themes ); ?> .testimonial-rating-<?php echo esc_attr( $themes ); ?> i.fa{
color:<?php echo esc_attr( $stars_color ); ?>;
font-size: 15px;
padding: 0px 3px;
}
.owl-theme .owl-controls .owl-buttons div{
background: transparent;
opacity: 1;
}
.owl-buttons{
position: absolute;
top: 8%;
width: 100%;
}
.owl-prev{
position: absolute;
left:30%;
}
.owl-next{
position: absolute;
right:30%;
}
@media only screen and (max-width: 479px){
.owl-prev{
left: 10%;
}
.owl-next{
right: 10%;
}
}
</style>
<script type="text/javascript">
jQuery(document).ready(function($){
$("#testimonial-slider-<?php echo esc_attr( $themes ); ?>").owlCarousel({
items:1,
autoplaySpeed: 1000,
loop: true,
itemsDesktop:[1199,1],
itemsDesktopSmall:[979,1],
itemsTablet:[768,1],
pagination: false,
navigation:<?php echo esc_attr( $navigation ); ?>,
navigationText:["<",">"],
autoplay:<?php echo esc_attr( $auto_play ); ?>,
smartSpeed: 450,
clone:true,
});
});
</script>
<div id="testimonial-slider-<?php echo esc_attr( $themes ); ?>" class="owl-carousel">
<?php
// Creating a new side loop
while ( $testimonials_query->have_posts() ) : $testimonials_query->the_post();
$client_name_value = get_post_meta(get_the_ID(), 'name', true);
$link_value = get_post_meta(get_the_ID(), 'position', true);
$company_value = get_post_meta(get_the_ID(), 'company', true);
$company_url = get_post_meta(get_the_ID(), 'company_website', true);
$company_url_target = get_post_meta(get_the_ID(), 'company_link_target', true);
$testimonial_information = get_post_meta(get_the_ID(), 'testimonial_text', true);
$company_ratings_target = get_post_meta(get_the_ID(), 'company_rating_target', true);
$imgurl = wp_get_attachment_url( get_post_thumbnail_id(get_the_ID()) );
if ( empty( $imgurl ) ) $imgurl = get_avatar_url( -1 );
?>
<div class="testimonial-<?php echo esc_attr( $themes ); ?>">
<div class="testimonial-thumb-<?php echo esc_attr( $themes ); ?>">
<img src="<?php echo esc_url( $imgurl ); ?>" alt="">
</div>
<?php if(!empty($testimonial_information)){ ?>
<p class="testimonial-description-<?php echo esc_attr( $themes ); ?>"><?php echo esc_html( $testimonial_information ); ?></p>
<?php } ?>
<div class="testimonial-rating-<?php echo esc_attr( $themes ); ?>">
<?php for( $i=0; $i <=4 ; $i++ ) {
if ($i < $company_ratings_target) {
$full = 'fa fa-star';
} else {
$full = 'fa fa-star-o';
}
echo "<i class=\"$full\"></i>";
}
?>
</div>
<div class="testimonial-description-profiles-<?php echo esc_attr( $themes ); ?>">
<span class="testimonial-description-title-<?php echo esc_attr( $themes ); ?>"><?php echo esc_attr( $client_name_value ); ?></span>
<small><a target="<?php echo esc_attr( $company_url_target ); ?>" href="<?php echo esc_url($company_url); ?>"><?php echo esc_html( $link_value ); ?></a></small>
</div>
</div>
<?php endwhile; ?>
</div>
<?php
wp_reset_postdata();
}
elseif( $themes=="theme2" ){ ?>
<style type="text/css">
#ktsttestimonial_list_style .client_content{
color:<?php echo esc_attr( $text_color ); ?>;
}
#ktsttestimonial_list_style .testimonial-rating-<?php echo esc_attr( $themes ); ?> i.fa{
color:<?php echo esc_attr( $stars_color ); ?>;
font-size: 18px;
padding: 0px 5px;
}
</style>
<div class="testimonials_list_area">
<?php
// Creating a new side loop
while ( $testimonials_query->have_posts() ) : $testimonials_query->the_post();
$client_name_value = get_post_meta(get_the_ID(), 'name', true);
$link_value = get_post_meta(get_the_ID(), 'position', true);
$company_value = get_post_meta(get_the_ID(), 'company', true);
$company_url = get_post_meta(get_the_ID(), 'company_website', true);
$company_url_target = get_post_meta(get_the_ID(), 'company_link_target', true);
$testimonial_information = get_post_meta(get_the_ID(), 'testimonial_text', true);
$company_ratings_target = get_post_meta(get_the_ID(), 'company_rating_target', true);
$imgurl = wp_get_attachment_url( get_post_thumbnail_id(get_the_ID()) );
if ( empty( $imgurl ) ) $imgurl = get_avatar_url( -1 );
?>
<div id="ktsttestimonial_list_style">
<div class="client_names"><?php echo esc_html( $client_name_value ); ?></div>
<div class="client_names_photo">
<img src="<?php echo esc_url( $imgurl ); ?>" alt="" class="photo" />
</div>
<div class="client_content"><span class="laquo"> </span><?php echo esc_html( $testimonial_information ); ?><span class="raquo"> </span></div>
<div class="client_content_info">
<div class="testimonial-rating-<?php echo esc_attr( $themes ); ?>">
<?php for( $i=0; $i <=4 ; $i++ ) {
if ($i < $company_ratings_target) {
$full = 'fa fa-star';
} else {
$full = 'fa fa-star-o';
}
echo "<i class=\"$full\"></i>";
}
?>
</div>
<a target="<?php echo esc_attr( $company_url_target ); ?>" href="<?php echo esc_url( $company_url ); ?>"><?php echo esc_html( $company_value ); ?></a>
<p><?php echo esc_html( $link_value ); ?></p>
</div>
</div>
<?php endwhile; wp_reset_postdata(); ?>
</div>
<?php
}
elseif( $themes=="theme3" ){ ?>
<style type="text/css">
div#testimonial-slider-<?php echo esc_attr( $themes ); ?> {
display: block;
overflow: hidden;
padding-top: 10px;
}
.testimonial-theme3-<?php echo esc_attr( $themes ); ?>{
margin: 0 15px;
}
.testimonial-theme3-<?php echo esc_attr( $themes ); ?> .testimonial-theme3-description-<?php echo esc_attr( $themes ); ?>{
position: relative;
font-size: 16px;
line-height:26px;
color: <?php echo esc_attr( $text_color); ?>;
padding: 25px 20px;
border:1px solid #d3d3d3;
}
.testimonial-theme3-<?php echo esc_attr( $themes ); ?> .testimonial-theme3-description-<?php echo esc_attr( $themes ); ?>:after{
content: "";
width: 20px;
height: 20px;
background: #fff;
border-style: none none solid solid;
border-width: 0 0 1px 1px;
border-color: #d3d3d3;
position: absolute;
bottom: -11px;
left: 6%;
transform: skewY(-45deg);
}
.testimonial-theme3-<?php echo esc_attr( $themes ); ?> .testimonial-theme3-pic-<?php echo esc_attr( $themes ); ?>{
width: 80px;
height: 80px;
border-radius: 50%;
overflow: hidden;
margin:20px 30px;
display: inline-block;
float: left;
}
.testimonial-theme3-<?php echo esc_attr( $themes ); ?> .testimonial-theme3-pic-<?php echo esc_attr( $themes ); ?> img{
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
.testimonial-theme3-<?php echo esc_attr( $themes ); ?> .testimonial-theme3-<?php echo esc_attr( $themes ); ?>-title{
display: inline-block;
text-transform: capitalize;
margin-top: 15px;
}
.testimonial-theme3-<?php echo esc_attr( $themes ); ?> .testimonial-theme3-<?php echo esc_attr( $themes ); ?>-title span{
color: #3498db;
display: block;
font-size:17px;
font-weight: bold;
margin-bottom: 10px;
}
.testimonial-theme3-<?php echo esc_attr( $themes ); ?> .testimonial-theme3-<?php echo esc_attr( $themes ); ?>-title small{
display: block;
font-size:14px;
}
.owl-theme .owl-controls{
position: absolute;
bottom: 10%;
right: 10px;
}
.owl-theme .owl-controls .owl-buttons div {
background: #000 none repeat scroll 0 0;
border-radius: 0;
color: #fff;
float: left;
margin-right: 5px;
padding: 0 10px;
}
@media only screen and (max-width: 767px){
.testimonial-theme3-<?php echo esc_attr( $themes ); ?> .testimonial-theme3-description-<?php echo esc_attr( $themes ); ?>{
font-size: 14px;
}
.testimonial-theme3-<?php echo esc_attr( $themes ); ?> .testimonial-theme3-description-<?php echo esc_attr( $themes ); ?>:after{
left: 14%;
}
}
@media only screen and (max-width: 479px){
.owl-theme .owl-controls{
bottom: 0;
}
.testimonial-theme3-<?php echo esc_attr( $themes ); ?> .testimonial-theme3-description-<?php echo esc_attr( $themes ); ?>:after{
left: 18%;
}
}
.testimonial-theme3-<?php echo esc_attr( $themes ); ?> .testimonial-rating-<?php echo esc_attr( $themes ); ?> i.fa{
color:<?php echo esc_attr( $stars_color ); ?>;
font-size: 15px;
padding: 0px 3px;
}
</style>
<script type="text/javascript">
jQuery(document).ready(function($){
$("#testimonial-slider-<?php echo esc_attr( $themes ); ?>").owlCarousel({
items:1,
autoplaySpeed: 1000,
loop: true,
itemsDesktop:[1199,1],
itemsDesktopSmall:[979,1],
itemsTablet:[768,1],
pagination: false,
navigation:<?php echo esc_attr( $navigation ); ?>,
navigationText:["<",">"],
autoplay:<?php echo esc_attr( $auto_play ); ?>,
smartSpeed: 450,
clone:true,
});
});
</script>
<div id="testimonial-slider-<?php echo esc_attr( $themes ); ?>" class="owl-carousel">
<?php
// Creating a new side loop
while ( $testimonials_query->have_posts() ) : $testimonials_query->the_post();
$client_name_value = get_post_meta(get_the_ID(), 'name', true);
$link_value = get_post_meta(get_the_ID(), 'position', true);
$company_value = get_post_meta(get_the_ID(), 'company', true);
$company_url = get_post_meta(get_the_ID(), 'company_website', true);
$company_url_target = get_post_meta(get_the_ID(), 'company_link_target', true);
$testimonial_information = get_post_meta(get_the_ID(), 'testimonial_text', true);
$company_ratings_target = get_post_meta(get_the_ID(), 'company_rating_target', true);
$imgurl = wp_get_attachment_url( get_post_thumbnail_id(get_the_ID()) );
if ( empty( $imgurl ) ) $imgurl = get_avatar_url( -1 );
?>
<div class="testimonial-theme3-<?php echo esc_attr( $themes ); ?>">
<?php if( !empty( $testimonial_information ) ){ ?>
<p class="testimonial-theme3-description-<?php echo esc_attr( $themes ); ?>"><?php echo esc_html( $testimonial_information ); ?></p>
<?php } ?>
<div class="testimonial-theme3-pic-<?php echo esc_attr( $themes ); ?>">
<img src="<?php echo esc_url( $imgurl ); ?>" alt="">
</div>
<div class="testimonial-rating-<?php echo esc_attr( $themes ); ?>">
<?php for( $i=0; $i <=4 ; $i++ ) {
if ($i < $company_ratings_target) {
$full = 'fa fa-star';
} else {
$full = 'fa fa-star-o';
}
echo "<i class=\"$full\"></i>";
}
?>
</div>
<div class="testimonial-theme3-<?php echo esc_attr( $themes ); ?>-title">
<span><?php echo esc_html( $client_name_value ); ?></span>
<small><?php echo esc_html( $link_value ); ?></small>
</div>
</div>
<?php endwhile; ?>
</div>
<?php
wp_reset_postdata();
}
elseif( $themes=="theme4" ){ ?>
<style type="text/css">
.testimonial-theme4-<?php echo esc_attr( $themes ); ?>{
text-align: center;
background: #fff;
}
.testimonial-theme4-<?php echo esc_attr( $themes ); ?> .testimonial-theme4-pic-<?php echo esc_attr( $themes ); ?>{
width: 100px;
height: 100px;
border-radius: 50%;
border: 5px solid rgba(255,255,255,0.3);
display: inline-block;
margin-top: 0px;
overflow: hidden;
box-shadow:0 2px 6px rgba(0, 0, 0, 0.15);
margin: 0 auto;
display:block;
}
.testimonial-theme4-<?php echo esc_attr( $themes ); ?> .testimonial-theme4-pic-<?php echo esc_attr( $themes ); ?> img{
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
.testimonial-theme4-<?php echo esc_attr( $themes ); ?> .testimonial-theme4-description-<?php echo esc_attr( $themes ); ?>{
font-size: 16px;
font-style: italic;
color: <?php echo esc_attr( $text_color ); ?>;
line-height: 30px;
margin: 10px 0 20px;
}
.testimonial-theme4-<?php echo esc_attr( $themes ); ?> .testimonial-theme4-title-<?php echo esc_attr( $themes ); ?>{
font-size: 14px;
font-weight: bold;
margin: 0;
color: #333;
text-transform: uppercase;
text-align:center;
}
.testimonial-theme4-<?php echo esc_attr( $themes ); ?> .testimonial-theme4-post-<?php echo esc_attr( $themes ); ?>{
display: block;
font-size: 13px;
color: #777;
margin-bottom: 15px;
text-transform: capitalize;
text-align:center;
}
.testimonial-theme4-<?php echo esc_attr( $themes ); ?> .testimonial-theme4-post-<?php echo esc_attr( $themes ); ?>:before{
content: "";
width: 30px;
display: block;
margin: 10px auto;
border: 1px solid #d3d3d3;
}
.testimonial-theme4-<?php echo esc_attr( $themes ); ?> .super-testimonial-<?php echo esc_attr( $themes ); ?> {
display: block;
overflow: hidden;
text-align: center;
}
.testimonial-theme4-<?php echo esc_attr( $themes ); ?> .testimonial-rating-<?php echo esc_attr( $themes ); ?> i.fa{
color:<?php echo esc_attr( $stars_color ); ?>;
font-size: 15px;
padding: 0px 3px;
}
</style>
<script type="text/javascript">
jQuery(document).ready(function($){
$("#testimonial-slider-<?php echo esc_attr( $themes ); ?>").owlCarousel({
items:1,
autoplaySpeed: 1000,
loop: true,
itemsDesktop:[1199,1],
itemsDesktopSmall:[979,1],
itemsTablet:[768,1],
pagination: false,
autoplay:<?php echo esc_attr( $auto_play );?>,
smartSpeed: 450,
clone:true,
});
});
</script>
<div id="testimonial-slider-<?php echo esc_attr( $themes ); ?>" class="owl-carousel">
<?php
// Creating a new side loop
while ( $testimonials_query->have_posts() ) : $testimonials_query->the_post();
$client_name_value = get_post_meta(get_the_ID(), 'name', true);
$link_value = get_post_meta(get_the_ID(), 'position', true);
$company_value = get_post_meta(get_the_ID(), 'company', true);
$company_url = get_post_meta(get_the_ID(), 'company_website', true);
$company_url_target = get_post_meta(get_the_ID(), 'company_link_target', true);
$testimonial_information = get_post_meta(get_the_ID(), 'testimonial_text', true);
$company_ratings_target = get_post_meta(get_the_ID(), 'company_rating_target', true);
$imgurl = wp_get_attachment_url( get_post_thumbnail_id(get_the_ID()) );
if ( empty( $imgurl ) ) $imgurl = get_avatar_url( -1 );
?>
<div class="testimonial-theme4-<?php echo esc_attr( $themes ); ?>">
<div class="testimonial-theme4-pic-<?php echo esc_attr( $themes ); ?>">
<img src="<?php echo esc_url( $imgurl ); ?>" alt="">
</div>
<div class="testimonial-theme4-description-<?php echo esc_attr( $themes ); ?>"><?php echo esc_html( $testimonial_information ); ?></div>
<h3 class="testimonial-theme4-title-<?php echo esc_attr( $themes ); ?>"><?php echo esc_html( $client_name_value ); ?></h3>
<span class="testimonial-theme4-post-<?php echo esc_attr( $themes ); ?>"><?php echo esc_html( $company_value ); ?></span>
<div class="testimonial-rating-<?php echo esc_attr( $themes ); ?>">
<?php for( $i=0; $i <=4 ; $i++ ) {
if ($i < $company_ratings_target) {
$full = 'fa fa-star';
} else {
$full = 'fa fa-star-o';
}
echo "<i class=\"$full\"></i>";
}
?>
</div>
</div>
<?php endwhile; ?>
</div>
<?php
wp_reset_postdata();
}
return ob_get_clean();
}
Code file location:
super-testimonial/super-testimonial/tp-testimonials.php
Conclusion
Now that you’ve learned how to embed the Super Testimonials Plugin shortcodes, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.
Leave a Reply