Elementor Template Shortcode for the Free Version
Adds a [wpide_elementor_template id="123"] shortcode that shows any saved Elementor template inside posts, widgets or other builders, without Elementor Pro.
Opens WPIDE on
Code
add_shortcode( 'wpide_elementor_template', function ( $atts ) {
static $depth = 0;
$atts = shortcode_atts( array( 'id' => 0 ), $atts, 'wpide_elementor_template' );
$id = absint( $atts['id'] );
if ( ! $id || $depth > 2 || ! class_exists( '\Elementor\Plugin' ) ) {
return '';
}
if ( 'elementor_library' !== get_post_type( $id ) || 'publish' !== get_post_status( $id ) ) {
return '';
}
$depth++;
$html = \Elementor\Plugin::instance()->frontend->get_builder_content_for_display( $id, true );
$depth--;
return $html;
} );
Notes
Find template IDs under Templates > Saved Templates. Only published templates are shown.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.