php - Wordpress add javascript in footer -


i need add script in site footer. i'm referencing footer.php:

<script src="wp-content/file/script.js"></ script>

at home functions normally, when access page child not find because search directory:

site/page-child/wp-content/file/script.js.

i saw have use:

  wp_enqueue_script ()

but should put code?

thank's

you need add "/" before url in order start root :

<script src="/wp-content/file/script.js"></ script> 

indeed @ home page looks yoursite.com/wp-content on other pages searches yoursite.com/current-page/wp-content , results in 404.

adding / make yoursite.com/wp-content


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -