0

I am using Polylang free to create a multilingual Wordpress website. My scripts are being loaded like this:

<script src="<?php bloginfo( 'url' ); ?>/wp-content/themes/themename/js/scripts.js" type="text/javascript"></script>

Which is true for the default language because Polylang does not change the default url: sitename/post.

When switching to English the url changes, therefore script files are lost, because there is no corresponding locale structure: sitename/en/post.

Console error in inspector (ignore link):

Loading failed for the with source “http://localhost:8888/sitename/en/wp-content/themes/themename/js/scripts.js”.

Help?

1 Answers1

0

Solved
It's not Polylang's fault or anything. Script src should go like this:

<script src="<?php echo get_template_directory_uri(); ?>/js/scripts.js" type="text/javascript"></script>