Below, you’ll find a detailed guide on how to add the Testimonial Builder Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Testimonial Builder Plugin shortcode not to show or not to work correctly.
Before starting, here is an overview of the Testimonial Builder Plugin and the shortcodes it provides:
"Testimonial – WordPress Testimonial Showcase Plugin Grid Plus Testimonial Slider is a dynamic plugin for showcasing testimonials. It presents feedback in an engaging slider format, adding credibility to your site."
- [TEST_B]
Testimonial Builder [TEST_B] Shortcode
The Testimonial Builder shortcode is a dynamic tool that fetches and displays testimonials. The ‘TestShortCode’ function is triggered when this shortcode is used. It checks if an ‘id’ is set in the passed attributes. If not, it leaves the ‘WPSM_TEST_ID’ empty. If an ‘id’ is present, it assigns it to ‘WPSM_TEST_ID’. Then, it requires the ‘content.php’ file, which presumably contains the logic to display the testimonial based on the ‘WPSM_TEST_ID’. Afterward, it resets the WordPress query and returns the output.
Shortcode: [TEST_B]
Parameters
Here is a list of all possible TEST_B shortcode parameters and attributes:
id
– Specifies the unique ID of the testimonial to display
Examples and Usage
Basic example – A simple usage of the testimonial-builder plugin shortcode to display a testimonial by referencing its ID.
[TEST_B id=1 /]
Advanced examples
Using the shortcode to display multiple testimonials by referencing their IDs. This will load and display the testimonials that match the provided IDs.
[TEST_B id="1,2,3" /]
Using the shortcode without any ID. This will load and display all testimonials available in the testimonial-builder plugin.
[TEST_B /]
PHP Function Code
In case you have difficulties debugging what causing issues with [TEST_B]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'TEST_B', 'TestShortCode' );
Shortcode PHP function:
function TestShortCode( $Id ) {
ob_start();
if(!isset($Id['id']))
{
$WPSM_TEST_ID = "";
}
else
{
$WPSM_TEST_ID = $Id['id'];
}
require("content.php");
wp_reset_query();
return ob_get_clean();
}
Code file location:
testimonial-builder/testimonial-builder/template/shortcode.php
Conclusion
Now that you’ve learned how to embed the Testimonial Builder Plugin shortcode, 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