Below, you’ll find a detailed guide on how to add the Testimonial Slider 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 Testimonial Slider Plugin shortcodes not to show or not to work correctly.
Before starting, here is an overview of the Testimonial Slider Plugin and the shortcodes it provides:

"Testimonial Slider is a dynamic WordPress plugin that allows you to beautifully display and manage client testimonials. With its easy-to-use interface, you can create an engaging showcase in no time."
- [tss-testimonial-submit]
- [rt-testimonial]
Testimonial Slider [tss-testimonial-submit] Shortcode
The Testimonial Slider Showcase shortcode is designed to create a submission form for testimonials. It generates a form within a div class, allowing users to input their testimonials. The PHP code for the shortcode triggers the ‘testimonial_submission’ function, which outputs a form with fields for front-end submission. It also includes a submit button and a response area for user interaction. The form is wrapped within a ‘tss-wrapper’ and ‘tss-submit-wrapper’ div classes for styling purposes. The ‘wp_footer’ action is added to include submission scripts.
Shortcode: [tss-testimonial-submit]
Examples and Usage
Basic example – A basic usage of the testimonial submission shortcode
[tss-testimonial-submit /]
PHP Function Code
In case you have difficulties debugging what causing issues with [tss-testimonial-submit]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'tss-testimonial-submit', [ $this, 'testimonial_submission' ] );
Shortcode PHP function:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | function testimonial_submission() { $h = null; $h .= "<div class='tss-wrapper tss-submit-wrapper'>" ; $h .= "<form id='tss-submit-form' method='post'>" ; $h .= TSSPro()->rtFieldGenerator( TSSPro()->tssFrontEndSubmitFields() ); $h .= "<div class='field-holder submit-holder'><input type='submit' class='tss-submit-button' value='" . esc_html__( 'Submit' , 'testimonial-slider-showcase' ) . "'></div>" ; $h .= '</form>' ; $h .= "<div id='tss-submit-response'></div>" ; $h .= '</div>' ; add_action( 'wp_footer' , [ $this , 'submission_scripts' ], 10 ); return $h ; } |
Code file location:
testimonial-slider-and-showcase/testimonial-slider-and-showcase/lib/classes/TSSFrontEndSubmission.php
Testimonial Slider [rt-testimonial] Shortcode
The ‘rt-testimonial’ shortcode is designed to display testimonials in a variety of layouts. It retrieves testimonial data, including author, designation, company, location, rating, and testimonial content. It also supports image and video testimonials, and allows for customization of columns, margins, and image types.
Shortcode: [rt-testimonial]
Parameters
Here is a list of all possible rt-testimonial shortcode parameters and attributes:
id
– Specifies the unique identifier of the testimonial
Examples and Usage
Basic Example – Display a testimonial by referencing the ID of the testimonial.
[rt-testimonial id=1 /]
Advanced Examples
Display multiple testimonials by referencing their IDs.
[rt-testimonial id="1,2,3,4" /]
Display testimonials with specific layout and column settings. Here, ‘layout’ sets the layout style of the testimonials, ‘dCol’ sets the number of columns for desktop view, ‘tCol’ sets the number of columns for tablet view, and ‘mCol’ sets the number of columns for mobile view.
[rt-testimonial id="1,2,3,4" layout="isotope" dCol=3 tCol=2 mCol=1 /]
Display testimonials with specific grid type and margin settings. Here, ‘gridType’ sets the type of grid for the testimonials and ‘margin’ sets the margin of the grid items.
[rt-testimonial id="1,2,3,4" gridType="masonry" margin="no" /]
Display testimonials with specific image type. Here, ‘imageType’ sets the shape of the image in the testimonials.
[rt-testimonial id="1,2,3,4" imageType="circle" /]
PHP Function Code
In case you have difficulties debugging what causing issues with [rt-testimonial]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'rt-testimonial', [ $this, 'testimonial_shortcode' ] );
Shortcode PHP function:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 | function testimonial_shortcode( $atts ) { $rand = wp_rand(); $layoutID = 'tss-container-' . $rand ; $html = null; $arg = []; $atts = shortcode_atts( [ 'id' => null, ], $atts , 'rt-testimonial' ); $scID = absint( $atts [ 'id' ] ); if ( $scID && ! is_null ( get_post( $scID ) ) ) { $scMeta = get_post_meta( $scID ); $buildMetas = $this ->metas( $scMeta , $scID ); $arg [ 'scMeta' ] = $scMeta ; $lazyLoadP = false; if ( $buildMetas ) { extract( $buildMetas ); } if ( ! in_array( $dCol , array_keys ( TSSPro()->scColumns() ), true ) ) { $dCol = 3; } if ( ! in_array( $tCol , array_keys ( TSSPro()->scColumns() ), true ) ) { $tCol = 2; } if ( ! in_array( $dCol , array_keys ( TSSPro()->scColumns() ), true ) ) { $mCol = 1; } $dColItems = $dCol ; $tColItems = $tCol ; $mColItems = $mCol ; $isIsotope = preg_match( '/isotope/' , $layout ); $isCarousel = preg_match( '/carousel/' , $layout ); $isVideo = preg_match( '/video/' , $layout ); /* Argument create */ $containerDataAttr = false; $containerDataAttr .= " data-layout='{$layout}' data-desktop-col='{$dCol}' data-tab-col='{$tCol}' data-mobile-col='{$mCol}'" ; // Validation. $dCol = $dCol == 5 ? '24' : round ( 12 / $dCol ); $tCol = $tCol == 5 ? '24' : round ( 12 / $tCol ); $mCol = $mCol == 5 ? '24' : round ( 12 / $mCol ); if ( $isCarousel ) { $dCol = $tCol = $mCol = 12; } $arg [ 'grid' ] = "rt-col-md-{$dCol} rt-col-sm-{$tCol} rt-col-xs-{$mCol}" ; $arg [ 'read_more' ] = $readMore ; $arg [ 'class' ] = $gridType . '-grid-item' ; $arg [ 'class' ] .= ' tss-grid-item' ; $preLoader = null; if ( $isIsotope ) { $arg [ 'class' ] .= ' isotope-item' ; $preLoader = 'tss-pre-loader' ; } if ( $isCarousel ) { $arg [ 'class' ] .= ' slide-item swiper-slide' ; $preLoader = 'tss-pre-loader' ; } $masonryG = null; if ( $gridType == 'even' ) { $masonryG = ' tss-even' ; $arg [ 'class' ] .= ' even-grid-item' ; } elseif ( 'masonry' === $gridType && ! $isIsotope && ! $isCarousel ) { $masonryG = ' tss-masonry' ; $arg [ 'class' ] .= ' masonry-grid-item' ; } if ( 'no' === $margin ) { $arg [ 'class' ] .= ' no-margin' ; } else { $arg [ 'class' ] .= ' default-margin' ; } if ( 'circle' === $imageType ) { $arg [ 'class' ] .= ' tss-img-circle' ; } $arg [ 'items' ] = $itemFields ; $arg [ 'shareItems' ] = []; $arg [ 'anchorClass' ] = null; $arg [ 'link' ] = $link ? true : false; // Start layout. $html .= TSSPro()->layoutStyle( $layoutID , get_post_meta( $scID ), $scID ); $html .= "<div class='rt-container-fluid tss-wrapper {$parentClass}' id='{$layoutID}' {$containerDataAttr}>" ; $html .= "<div data-title='" . esc_html__( 'Loading ...' , 'testimonial-slider-showcase' ) . "' class='rt-row tss-{$layout}{$masonryG} {$preLoader}'>" ; // WP_Query args. $tssArgs = TSSPro()->buildArgs( $buildMetas , $isCarousel ); $tssQuery = new WP_Query( $tssArgs ); if ( $tssQuery ->have_posts() ) { if ( $isIsotope ) { $terms = get_terms( [ 'taxonomy' => TSSPro()->taxonomies[ 'category' ], 'hide_empty' => false, 'orderby' => 'meta_value_num' , 'order' => 'ASC' , 'meta_key' => '_order' , ] ); $html .= '<div class="tss-iso-filter"><div id="iso-button-' . absint( $rand ) . '" class="tss-isotope-button-wrapper tooltip-active filter-button-group">' ; $htmlButton = null; $fSelectTrigger = false; if ( ! empty ( $terms ) && ! is_wp_error( $terms ) ) { foreach ( $terms as $term ) { $fSelect = null; if ( $tItem == $term ->term_id ) { $fSelect = ' selected' ; $fSelectTrigger = true; } $htmlButton .= "<span class='rt-iso-button {$fSelect}' data-filter-counter='' data-filter='.iso_{$term->term_id}' {$fSelect}>" . $term ->name . '</span>' ; } } if ( empty ( $isotopeShowAll ) ) { $fSelect = ( $fSelectTrigger ? null : ' selected' ); $html .= "<span class='rt-iso-button{$fSelect}' data-filter-counter='' data-filter='*'>" . esc_html__( 'Show all' , 'testimonial-slider-showcase' ) . '</span>' ; } $html .= $htmlButton ; $html .= '</div>' ; if ( ! empty ( $isotopeSearchFilter ) ) { $html .= "<div class='iso-search'><input type='text' class='iso-search-input' placeholder='" . esc_html__( 'Search ', ' testimonial-slider-showcase ' ) . "' /></div>"; } $html .= '</div>' ; $html .= '<div class="tss-isotope" id="tss-isotope-' . $rand . '">' ; } elseif ( $isCarousel ) { $autoPlay = ( in_array( 'autoplay' , $cOpt , true ) ? 'true' : 'false' ); $autoPlayHoverPause = ( in_array( 'autoplayHoverPause' , $cOpt , true ) ? 'true' : 'false' ); $nav = ( in_array( 'nav' , $cOpt , true ) ? 'true' : 'false' ); $dots = ( in_array( 'dots' , $cOpt , true ) ? 'true' : 'false' ); $loop = ( in_array( 'loop' , $cOpt , true ) ? 'true' : 'false' ); $lazyLoad = ( in_array( 'lazy_load' , $cOpt , true ) ? 'true' : 'false' ); $lazyLoadP = ( in_array( 'lazy_load' , $cOpt , true ) ? true : false ); $autoHeight = ( in_array( 'auto_height' , $cOpt , true ) ? 'true' : 'false' ); $rtl = ( in_array( 'rtl' , $cOpt , true ) ? 'dir="rtl"' : '' ); $carouselWrapper = 'carousel11' === $layout || 'carousel12' === $layout ? 'tss-carousel-main' : 'tss-carousel' ; if ( 'carousel11' === $layout ) { $html .= $this ->renderThumbSlider( $scID , $tssQuery , $scMeta , $arg ); } $html .= '<div class="carousel-wrapper">' ; $html .= "<div { $rtl } class = '{$carouselWrapper} swiper' data-loop= '{$loop}' data-items-desktop= '{$dColItems}' data-items-tab= '{$tColItems}' data-items-mobile= '{$mColItems}' data-autoplay= '{$autoPlay}' data-autoplay-timeout= '{$autoplayTimeout}' data-autoplay-hover-pause= '{$autoPlayHoverPause}' data-dots= '{$dots}' data-nav= '{$nav}' data-lazy-load= '{$lazyLoad}' data-auto-height= '{$autoHeight}' data-smart-speed= '{$smartSpeed}' >"; $html .= '<div class="swiper-wrapper">' ; } while ( $tssQuery ->have_posts() ) : $tssQuery ->the_post(); $iID = get_the_ID(); $arg [ 'iID' ] = $iID ; $arg [ 'author' ] = get_the_title(); $arg [ 'designation' ] = get_post_meta( $iID , 'tss_designation' , true ); $arg [ 'company' ] = get_post_meta( $iID , 'tss_company' , true ); $arg [ 'location' ] = get_post_meta( $iID , 'tss_location' , true ); $arg [ 'rating' ] = get_post_meta( $iID , 'tss_rating' , true ); $arg [ 'video' ] = get_post_meta( $iID , 'tss_video' , true ); $arg [ 'social_media' ] = get_post_meta( $iID , 'tss_social_media' , true ); $arg [ 'pLink' ] = get_permalink(); $aHtml = null; if ( in_array( 'read_more' , $arg [ 'items' ], true ) && function_exists( 'rttsp' ) ) { $aHtml = "<a class='rt-read-more' href='" . esc_url( $arg ['pLink '] ) . "' >{ $arg [ 'read_more' ]}</a>"; } if ( $testi_limit ) { $arg [ 'testimonial' ] = TSSPro()->strip_tags_content( get_the_content(), $testi_limit , $aHtml ); } else { $arg [ 'testimonial' ] = get_the_content(); } $arg [ 'video_url' ] = get_post_meta( $iID , 'tss_video' , true ); if ( $isIsotope && taxonomy_exists( TSSPro()->taxonomies[ 'category' ] ) ) { $termAs = wp_get_post_terms( $iID , TSSPro()->taxonomies[ 'category' ], [ 'fields' => 'all' ] ); $isoFilter = null; if ( ! empty ( $termAs ) ) { foreach ( $termAs as $term ) { $isoFilter .= ' ' . 'iso_' . $term ->term_id; $isoFilter .= ' ' . $term ->slug; } } $arg [ 'isoFilter' ] = $isoFilter ; } if ( $lazyLoadP ) { $arg [ 'lazyLoad' ] = true; $arg [ 'img' ] = TSSPro()->getFeatureImage( $iID , $imgSize , $customImgSize , $defaultImgId , true ); } else { $arg [ 'lazyLoad' ] = false; $arg [ 'img' ] = TSSPro()->getFeatureImage( $iID , $imgSize , $customImgSize , $defaultImgId ); } // Render layout. $html .= TSSPro()->render( 'layouts/' . $layout , $arg ); endwhile ; if ( $isIsotope ) { $html .= '</div>' ; // End isotope. } elseif ( $isCarousel ) { if ( 'grid' !== $scMeta [ 'tss_layout' ] ) { $html .= '</div>' ; $html .= 'true' === $nav ? '<div class="swiper-arrow swiper-button-next"><i class="rttss-right-open"></i></div><div class="swiper-arrow swiper-button-prev"><i class="rttss-left-open"></i></div>' : '' ; $html .= 'true' === $dots ? '<div class="swiper-pagination"></div>' : '' ; $html .= '</div>' ; $html .= '</div>' ; // End Carousel item holder. if ( 'carousel12' === $layout ) { $html .= $this ->renderThumbSlider( $scID , $tssQuery , $scMeta , $arg ); } } } } else { $html .= '<p>' . esc_html__( 'No testimonial found' , 'testimonial-slider-showcase' ) . '</p>' ; } if ( $isIsotope || $isCarousel ) { $html .= '<div class="rt-loading-overlay"></div><div class="rt-loading rt-ball-clip-rotate"><div></div></div>' ; } $html .= '</div>' ; // End row. if ( $hasPagination && ! $isCarousel ) { $htmlUtility = null; $postPp = $tssQuery ->query_vars[ 'posts_per_page' ]; $page = $tssQuery ->query_vars[ 'paged' ]; $foundPosts = $tssQuery ->found_posts; $morePosts = $foundPosts - ( $postPp * $page ); $totalPage = $tssQuery ->max_num_pages; $foundPost = $tssQuery ->found_posts; if ( $scMeta [ 'tss_limit' ][0] ) { $range = $scMeta [ 'tss_posts_per_page' ][0]; $foundPost = $tssQuery ->found_posts; if ( $range && $foundPost > $range ) { $foundPost = $scMeta [ 'tss_limit' ][0]; $totalPage = ceil ( $foundPost / $range ); } } $foundPosts = $foundPost ; if ( 'pagination' === $paginationType ) { $htmlUtility .= TSSPro()->pagination( $totalPage , $postPp ); } elseif ( 'pagination_ajax' === $paginationType && ! $isIsotope ) { $htmlUtility .= TSSPro()->pagination( $totalPage , $postPp , true, $scID ); } elseif ( 'load_more' === $paginationType ) { $morePosts = $foundPosts - ( $postPp * $page ); $noMorePostText = esc_html__( 'No More Post to load' , 'testimonial-slider-showcase' ); $loadingText = esc_html__( 'Loading ...' , 'testimonial-slider-showcase' ); $htmlUtility .= '<div class = "tss-load-more" > <span class = "rt-button" data-sc-id= "' . absint( $scID ) . '" data-total-pages= "' . absint( $totalPage ) . '" data-posts-per-page= "' . $postPp . '" data-found-posts= "' . absint( $foundPosts ) . '" data-paged= "1" data-no-more-post-text= "' . esc_attr( $noMorePostText ) . '" data-loading-text= "' . esc_attr( $loadingText ) . '" > ' . esc_html( $loadMore ) . ' <span>( ' . esc_html( $morePosts ) . ' )</span></span> </div>'; } elseif ( 'load_on_scroll' === $paginationType ) { $htmlUtility .= '<div class="tss-scroll-load-more" data-trigger="1" data-sc-id="' . absint( $scID ) . '" data-paged="2"></div>' ; } if ( $htmlUtility ) { $html .= "<div class='tss-utility'>" . $htmlUtility . '</div>' ; } } $html .= '</div>' ; // tss-container. wp_reset_postdata(); $scriptGenerator = []; $scriptGenerator [ 'layout' ] = $layoutID ; $scriptGenerator [ 'rand' ] = $rand ; $scriptGenerator [ 'scMeta' ] = $scMeta ; $scriptGenerator [ 'isIsotope' ] = ( $isIsotope || 'masonry' === $gridType ? true : false ); $scriptGenerator [ 'isCarousel' ] = $isCarousel ; $this ->scA[] = $scriptGenerator ; add_action( 'wp_footer' , [ $this , 'register_scripts' ] ); } else { $html .= '<p>' . esc_html__( 'No shortCode found' , 'testimonial-slider-showcase' ) . '</p>' ; } return $html ; } |
Code file location:
testimonial-slider-and-showcase/testimonial-slider-and-showcase/lib/classes/TSSProSC.php
Conclusion
Now that you’ve learned how to embed the Testimonial Slider 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