parse enclosing shortcode in a visual editor (e.g. Divi)
-
Hello,
I’ve created a custom enclosing shortcode. It works in the Classic editor, but when I inserted it into a Divi builder, it does not work properly.
My shortcode is an enclosing shortcode (I followed this tutorial: https://developer.www.ads-software.com/plugins/shortcodes/enclosing-shortcodes/).
For example:
[my_shortcode]
here’s the content
[/my_shortcode]
I added the open and closing code to Divi builder as a code module. The content is another modules (text, image, etc). The problem is the closing shortcode prints out the screen “[/my_shortcode]”.
My minimal code is that:function lsz_init() { add_shortcode('my_shortcode', 'lsz_shortcode'); } add_action( 'init', 'lsz_init' ); function lsz_shortcode($param, $content =null) { return $content; }
The general problem is that Divi ads its shortcodes also to the content, and these mixed. May be I have to parse somehow, but I have no idea how. Do you have any good example for that?
Membermouse did it, they parse it using _content filter. This code is not open source, so I can’t check it.
Thanks for your help!
- The topic ‘parse enclosing shortcode in a visual editor (e.g. Divi)’ is closed to new replies.