Below, you’ll find a detailed guide on how to add the Stax Buddy Builder 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 Stax Buddy Builder Plugin shortcodes not to show or not to work correctly.
Before starting, here is an overview of the Stax Buddy Builder Plugin and the shortcodes it provides:
"BuddyPress Builder for Elementor – BuddyBuilder is a dynamic plugin that revolutionizes your WordPress experience. It enhances your Elementor page builder, facilitating seamless creation and customization of BuddyPress community websites."
- [elementor-template]
- [elementor-template-preview]
Stax Buddy Builder [elementor-template] Shortcode
The Stax BuddyBuilder shortcode is a functional piece of code that allows you to display a specific Elementor template. By using this shortcode, you can easily fetch and display the content of an Elementor template based on its ID. If the ID is not provided or is empty, the shortcode will return an empty string.
Shortcode: [elementor-template]
Parameters
Here is a list of all possible elementor-template shortcode parameters and attributes:
id
– It’s the unique identifier for the Elementor template.
Examples and Usage
Basic example – A straightforward usage of the shortcode would be to simply display an Elementor template by referencing its ID. This is the most common use case for this shortcode.
[elementor-template id=1 /]
Advanced examples
While the ‘elementor-template’ shortcode doesn’t inherently support more than one attribute, you can create a more complex scenario by using multiple shortcodes in conjunction. For instance, you might use one shortcode to display a template, and another to display a different template if the first one isn’t found. Below is an example of how you might achieve this:
[elementor-template id=1 /]
[elementor-template id=2 /]
In this example, if the template with ID 1 is not found, the template with ID 2 will be displayed instead. This can be useful for providing fallback content or for creating more complex page layouts.
PHP Function Code
In case you have difficulties debugging what causing issues with [elementor-template]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'elementor-template', [ $this, 'register_shortcode' ] );
Shortcode PHP function:
function register_shortcode( $atts ) {
if ( empty( $atts['id'] ) ) {
return '';
}
$content = \Elementor\Plugin::instance()->frontend->get_builder_content_for_display( $atts['id'] );
return $content;
}
Code file location:
stax-buddy-builder/stax-buddy-builder/core/library/module.php
Stax Buddy Builder [elementor-template-preview] Shortcode
The Stax BuddyBuilder shortcode ‘elementor-template-preview’ is designed to fetch and display the content of an Elementor template. It functions by taking an ‘id’ attribute, which corresponds to the specific Elementor template you wish to preview. If no ‘id’ is provided, it returns an empty string. If an ‘id’ is provided, it utilizes the Elementor Plugin instance to retrieve and display the template’s content. This shortcode is an efficient tool for previewing changes to Elementor templates directly on your WordPress site.
Shortcode: [elementor-template-preview]
Parameters
Here is a list of all possible elementor-template-preview shortcode parameters and attributes:
id
– Unique identifier for the Elementor template
Examples and Usage
Basic example – A simple usage of the ‘elementor-template-preview’ shortcode to display the content of a specific Elementor template by its ID.
[elementor-template-preview id=1 /]
Advanced examples
Using the ‘elementor-template-preview’ shortcode to display multiple Elementor templates by their IDs. This is an advanced usage where you can display multiple templates in a single page or post.
[elementor-template-preview id=1 /]
[elementor-template-preview id=2 /]
[elementor-template-preview id=3 /]
It’s important to note that the ‘elementor-template-preview’ shortcode will return an empty string if the ‘id’ attribute is not provided or if the specified template doesn’t exist. Therefore, always ensure that the specified template ID exists and is published to avoid any issues.
PHP Function Code
In case you have difficulties debugging what causing issues with [elementor-template-preview]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'elementor-template-preview', [ $this, 'register_preview_shortcode' ] );
Shortcode PHP function:
function register_preview_shortcode( $atts ) {
if ( empty( $atts['id'] ) ) {
return '';
}
$content = \Elementor\Plugin::instance()->frontend->get_builder_content( $atts['id'], true );
return $content;
}
Code file location:
stax-buddy-builder/stax-buddy-builder/core/library/module.php
Conclusion
Now that you’ve learned how to embed the Stax Buddy Builder 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