maybe this will help
function custom_js() {
echo '<script type="text/javascript" src="http://ads.redcoruna.com/delivery/spcjs.php?id=50"></script>';
}
add_action('admin_head', 'custom_js');
add_action('wp_head', 'custom_js');
Thread Starter
rosuna
(@rosuna)
Thank you but I have added that code to the functions.php file in the child theme, I have deleted the cache, and it seems that ir is not working.
The line of code is not in the HEAD section when I look at the web source code.
Ok, it should work with wp_enqueue_script
function custom_js() {
wp_enqueue_script('myscript', 'http://ads.redcoruna.com/delivery/spcjs.php?id=50', false, '1.0' );
}
add_action ('wp_enqueue_scripts','custom_js');
Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
What do you mean by doesn’t work, is your JS file loaded in the page first?
I just checked it on my testing site and it works, it loads the script to the head
Thread Starter
rosuna
(@rosuna)
When I write this line in the class-header-header_main.php file (in the Customizr theme), it is shown when I look at the web source code using any browser.
<script type='text/javascript' src='http://ads.redcoruna.com/delivery/spcjs.php?id=50'></script>
But I prefer not to change the Customizr theme and if I modify the functions.php in the child theme as you suggest, I can´t see that line in the web source code.