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

symfony - TEST environment only: The database schema is not in sync with the current mapping file -

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -