Hello! I need to insert a simple javascript code like this:
Header:
<script type=”text/javascript” language=”javascript” src=”https://sistema.aseguratuviaje.com/scripts/clientcoti.js”></script>
<script>$(document).ready(function () {createlanding(“bIItuwcKAtHrdkfY5aAScxGPAVi6vlLqZWRH5CMsc622IcK1mn3k2g%3d%3d”,1,””,”es-ES”, 0);});</script>
Body:
<div id=”landing”></div>
In this post: https://www.mochilero.info/seguros-de-viaje/
But it doesnt work. I tried too with this another code:
<script language=’Javascript’ src=’http://www.bookhostels.com/files/index.php?UserID=Mochilero.info&File=bighw&Language=Spanish&Currency=USD&NewWindow=1&PropTypeSelect=’ charset=’utf-8′></script>
Here: https://www.mochilero.info/hostels/
But both doesnt work. I asked and it isnt a hosting problem because I tested them in a simple html file and they work.
I need some help with this stuff, there are simple search boxes. Thanks!
If it were me, I’d probably do this with ACF and make custom field where you could install that ‘per post’ — then edit the header.php to call the ACF field “if” it’s used. Then in the template(s) you’re using use the “if used” method for ACF field, to add the div ID above the normal post area.
If that makes no sense, probably need to hire a developer.
I don’t work here; but TD might have better answer. 🙂
(I do stuff like this in a custom report platform I built in WP, and using ACF for custom fields per report, where some content is added to post template only if something is actually in the custom field.)
Ahhh thanks for the quick answer… but im not a pro, so i dont know nothing about ACF 🙁 Before Newspaper i used another wordpress theme with those codes and i didnt have any problem… I copied and pasted the code in the header section (in the custom code section from the Newspaper theme panel), so i cant understand where is the problem.
I tried too, but it doesnt work 🙁
I have this another more simple example:
This code:
<script language=’Javascript’ src=’http://www.bookhostels.com/files/index.php?UserID=Mochilero.info&File=bighw&Language=Spanish&Currency=USD&NewWindow=1&PropTypeSelect=’ charset=’utf-8′></script>
Works perfectly here in a html file:
http://mochilero.info/hostelworld.html
But here, inside the theme, doesnt works:
https://www.mochilero.info/hostels/
Should I add something else to Head?
My Head code now is: (inside head.php)
<head>
<div id=”fb-root”></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = “//connect.facebook.net/es_LA/sdk.js#xfbml=1&version=v2.8&appId=100643850012880″;
fjs.parentNode.insertBefore(js, fjs);
}(document, ‘script’, ‘facebook-jssdk’));</script>
<script type=”text/javascript” language=”javascript” src=”https://sistema.aseguratuviaje.com/scripts/clientcoti.js”></script>
<script>$(document).ready(function () {createlanding(“bIItuwcKAtHrdkfY5aAScxGPAVi6vlLqZWRH5CMsc622IcK1mn3k2g%3d%3d”,1,””,”es-ES”, 0);});</script>
<title><?php wp_title(‘|’, true, ‘right’); ?></title>
<meta charset=”<?php bloginfo( ‘charset’ );?>” />
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
<link rel=”pingback” href=”<?php bloginfo( ‘pingback_url’ ); ?>” />
<?php
wp_head(); /** we hook up in wp_booster @see td_wp_booster_functions::hook_wp_head */
?>
</head>
Hi,
If you want to display custom content in the post pages, probably you need to edit the post template files in the theme. Each post template has a corresponding single and loo-single file – https://www.screencast.com/t/P4ZNnRzOb
The code most likely has a part that needs to be entered in the header file, and maybe something that needs to be placed in the post files, in order to appear on the posts. Try inserting that part in the loop-single file corresponding to the post template you are using. Editing one of the loop files you can see the post structure
– https://www.screencast.com/t/KTW2wRw5ZXyD
Thanks