Hi,
I have a strange problem with the code block element: Regardless of whether I insert normal JS or an iFrame code, the code is always visible in the editor, but on the page the code is not even in the source code. But if I insert the iFrame code in the text block, it works.
As soon as I switch the theme to another one, the problem is solved.
Regards
Bernd
Hey Bernd,
Thank you for the inquiry.
We don’t recommend embedding scripts or iframes in a Text or Code Block as they could break the builder or the layout of the page. Instead, you can create a custom shortcode or register the script properly using native WordPress functions.
// https://codex.wordpress.org/Shortcode_API
// https://developer.wordpress.org/reference/functions/wp_enqueue_script/
Best regards,
Ismael
Apart from Ismael’s comment: on the “Advanced” tab: have you set “Action with codeblock” to : “Add codeblock to content”?
maybe a script could cause problems here – but an iframe should always work properly – if the iframe code is correct.
Hi,
I know, that scripts in a text or code block could break the builder. But the iframe-code is correct, also a tested script. I am not a newbie… ;-) Both things works on many of our other client-websites with enfold.
Anyway… The problem is solved ;-) I found out that in combination with the theme Enfold and the plugin wp-Typography causes the problem and removes any custom HTML code or scripts from the source code. Use the css-class “donotseparate” in the code block element and everything is fine :-)
This topic can be closed.
Regards
Bernd
Hi,
Thanks for the update, we’ll close this thread for now then. Please open a new thread if you should have any further questions or problems.
Best regards,
Rikard