Skip Navigation

[Resolved] visual editor cell removing tags

This support ticket is created 8 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 0.08 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 5 replies, has 2 voices.

Last updated by Luo Yang 8 years ago.

Assisted by: Luo Yang.

Author
Posts
#439934
Screen Shot 2016-09-26 at 10.42.15.png
Screen Shot 2016-09-26 at 10.42.15.png
Screen Shot 2016-09-26 at 10.38.21.png

I am trying to: add a <script> tag to a specific part of my layout (for google adsense). I've added the code that was supplied by google.

I save the VE cell and reload the front-end web page but the content doesn't show up.

When I then open the visual editor cell again, the script tags have been removed. This doesn't seem to happen if I just add a script tag on a standard wordpress page editor.

Am I missing something?

Any help is always much appreciated.

#440215

Dear daniel,

This expected result, We sanitize HTML and do not allow Scripts in Layouts visual editor Cells.
I suggest you replace the visual editor cell with Content template cell,
https://toolset.com/documentation/user-guides/content-template-cell/
then you will be able to setup the custom JS codes in the javascript window of content template

#442218

Thanks for the help,

I get that I can put the actual JS code in the JS editor.

So what would be the advised way of adding the call to:

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

I have to say I'm surprised at how hard it has been to copy and paste a snippet from google. I can't be the only toolset user using adsense =0]

#442462

You can create a custom shortcode for it, for example, add below codes into your theme/functions.php:

add_shortcode( 'ggad', 'ggad_func' );
function ggad_func() {
	return '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>';
}

Then put the shortcode [ggad] into the content template or visual editor content. and test again.

#442760

Thanks Luo,

I'll take a look later.

#442922

OK, please let me know if you need more assistance for it, thanks

This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.