Elementor page builder shortcode issue

Viewed 6584

I'm facing a weird problem when using the Elementor Wordpress Page Builder.

After creating a custom shortcode and inserting it into any page position, it also shows up at the top of the page, but only in Edit mode.

Top of the page:

Top of the page

Place where I want to insert shortcode:

place where i want to insert shortcode

2 Answers

This is my working example:

  function name_it( ){
        ob_start();

        function_name();

        $content = ob_get_clean();
        return $content;
   return function_name();
}
add_shortcode( 'shortcode_name', 'name_it' );

Just look at function_name(); and return function_name(); lines to avoid errors.

Related