![]() |
Scripting / wp / .htaccess kinda question [help!]
Hey all.
I've never had this problem before, but I'm sure it's something simple. Right so first things first. I'm trying to include a piece of java script into wordpress. Code:
<script type="text/javascript" src="http://domain.com/wp-content/plugins/pluginfolder"></script> What is the way round this? I'm guessing it's something simple but never had to do it before. Thanks for any suggestions :thumbsup |
So basically all I get when trying to access the script, is a 404 error because it is trying to find a post or page.
|
Quote:
Usually your source comes from a file: domain.com/wp-content/plugins/pluginfolder/myjavascript.js Or some such. |
Quote:
|
Quote:
|
yeah if you're trying to include a javascript, you'd have to include the actual file, not folder. Hit me and I can help real quick before I leave.
|
So is there not a rewrite rule, or exclude I do to stop it?
Or give an exception to a certain page etc... ? |
double check your path and be sure to include the filename, this has nothing to do with .htaccess or permalinks, as long as your absolute URI path is correct, you shouldn't get a 404. I'd understand some javascript not working because it's the wrong order (ie you need to call jquery or any other library first and then the script), but it shouldn't give you a 404, so chances are you have the wrong path
|
Quote:
I was doing the file (made a mistake above) e.g.: /path/folder/file.js Would be nice to know a rule for .htaccess to stop it from rewriting a path though if anybody knows how to do it? |
Quote:
Since it looks from here like you were calling a folder then my guess is apache did not find the folder or if the folder existed it did not find a default page so then it went 404. |
Quote:
http://domain.com/wp-includes/plugin...folder/file.js and /wp-include/filefolder/file.js And neither of them worked. So I put the file onto a subdomain and it's now working. |
Quote:
If you used /path/folder/file.js you'll ALWAYS get a 404. You need to use php bloginfo('template_directory') to locate the file, like the example below: Code:
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/scripts/my_js_file.js"></script> |
Ok before I confuse you all let me start again and try and be more clear :)
I used the following code: Code:
<script type="text/javascript" src="http://domain.com/wp-includes/plugins/filefolder/file.js"></script> But it wasn't working, so I type in the full path as above, and it went to a 404 error page. "SORRY, WHAT YOU ARE LOOKING FOR ISN'T THERE" So I then tried using the following code: Code:
<script type="text/javascript" src="/wp-includes/plugins/folder/file.js"></script> Now I have put it onto scripts.domain.com and put the files into the root and used this code Code:
<script type="text/javascript" src="http://scripts.domain.com/file.js"></script> But if it was giving out a 404 error for the path, wordpress and/or my .htaccess must have been re-writing the path right? |
Quote:
|
Quote:
|
always use blog info
|
All times are GMT -7. The time now is 10:38 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123