Hi,
I created a simple shortcode and when I put it in a text block in builder it renders *above* the slider, right after div id=”main”. It happens even with a very simple shortcode:
function example_shortcode() {
echo "Test";
}
add_shortcode( 'example_shortcode', 'example');
You can see the issue here:
Shortcode in textblock: http://www.imm.io/1dYz0
Rendering of the shortcode in the frontend: http://www.imm.io/1dYzu
Hi vinko
You should be using return inside the function. Example:
// Add Shortcode
function my_custom_shortcode() {
// Code
return 'example';
}
add_shortcode( 'example', 'my_custom_shortcode' );
Which should work correctly. Another example but with enclosing:
// Add Shortcode
function bold_text_shortcode( $atts , $content = null ) {
// Code
return '<strong>' . $content . '</strong>';
}
add_shortcode( 'b', 'bold_text_shortcode' );
Regards,
Devin
Well, that’s how we beginners learn! Thank you very much!