I am trying to include a very simple snippet of CSS and JavaScript to a Modx page that lists recent newsletters from MailChimp:
<style type="text/css">
.display_archive {font-family: arial,verdana; font-size: 12px;}
.campaign {line-height: 125%; margin: 5px;}
</style>
<script language="javascript" src="//ZZZZ.us11.list-manage.com/generate-js/?u=XXXXX&fid=YYYYY&show=10" type="text/javascript"></script>
The <script>
tag is returning a document.write()
that outputs a list of links.
Unfortunately it looks like TinyMCE blocks <style>
and <script>
tags and this code is not being added. What is the best way to add this code chunk to a specific page?
I found this page that shows ways to add code to the <head>
or <body>
tags, but I am looking to insert the code on a specific part of the page (since it does document.write
, the placement is important.
I was thinking an alternative is to create a snippet that does:
$response = file_get_contents('https://ZZZZZ.us11.list-manage.com/generate-js/?u=XXXXX&fid=YYYYY&show=10')
// remove "document.write"
// unescape slashes
return $clean_html;
But this does not seem like it would be the best method.
` tags. Wouldnt adding script/style to `extended_valid_elements` pose a security issue?
– Bijan Mar 08 '23 at 23:06