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
Post a Comment