Javascript on wordpress website page disappears as soon as I try to save it -


i'm trying insert javascript wordpress page. added functions.php:

function add_custom_code() {   if (is_front_page()) { ? >     < script >       (function() {         var randomid = math.floor(math.random() * 100000);         var targetelemid = ‘bcom_rwidget_’ + randomid;         document.write(‘ < div id = ”‘+targetelemid + ‘” > < /div>‘);         var script = document.createelement(‘script’);         script.type = ‘text / javascript’;         script.async = true;         script.src = ‘http: //www.booking.com/review_widget/gb/the-manor-house-bed-amp-breakfast-enter code here`trunch.en.html?tmpl=review_widget/review_widget&wid=’ + targetelemid + ‘&wtype=box_small&hotel_id=xxxxx&`enter code here`widget_language=en’;           var node = document.getelementsbytagname(‘script’)[0];         node.parentnode.insertbefore(script, node);       }()); < /script> < ? php   } } add_action('wp_footer', 'add_custom_code'); 

but when add script page, disappears try save it.

how can run secure javascript on wordpress page?

have tried writing javascript in diffrent file, enqueueing in functions.php , calling in case of front page?


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -