i just lrned how to create template path for .js file-
<script type="text/javascript" src="<?php bloginfo( 'template_directory' ); ?>js/scripts.js" ></script>
but inside my ‘scripts.js’ file has included some .js files like below:
include(‘js/jquery.easing.1.3.js’);
include(‘js/jquery-ui-1.8.11.custom.min.js’);
include(‘js/jquery.transform-0.9.3.min.js’);
include(‘js/jquery.animate-colors-min.js’);
…..and so on
any1 pls help me how can i make path for those included .js file in easiest way. i’m vry new in wordpress.
You can probably just change it to
etc. So without the “js/”.
If I understand correctly, you’re including files in the javascript file scripts.js that are in the same directory.
Including files without prepending a
/
always means you’re searching through the current directory. So basically, you’re trying to includejs/js/jquery.easing.1.3.js
, which doesn’t exist.EDIT:
If you’re trying to use a PHP include inside a Javascript file, it will not work. You shouldn’t do the including in the Javascript file anyway, just do it in the file you’re including scripts.js as such:
etc.
Here is the code to include the JS files in the theme:
Cheers
Or if your purpose is to embed all JS files contents in one JS file, you should use the following, This will use the file path of the files, not the URL addresses:
bloginfo( 'template_directory' );
is the correct way because wordpress themes require the complete path.
and if you want to use
include()
then use something like this :include(bloginfo('template_directory') . 'js/jquery.easing.1.3.js')