![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Such Fun!
Industry Role:
Join Date: Feb 2008
Posts: 13,900
|
![]() 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 ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Such Fun!
Industry Role:
Join Date: Feb 2008
Posts: 13,900
|
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.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 | |
see you later, I'm gone
Industry Role:
Join Date: Oct 2002
Posts: 14,110
|
Quote:
Usually your source comes from a file: domain.com/wp-content/plugins/pluginfolder/myjavascript.js Or some such.
__________________
All cookies cleared! |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 | |
Such Fun!
Industry Role:
Join Date: Feb 2008
Posts: 13,900
|
Quote:
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
see you later, I'm gone
Industry Role:
Join Date: Oct 2002
Posts: 14,110
|
so domain.com/wp-content/plugins/pluginfolder is the name of a file? Not a folder?
__________________
All cookies cleared! |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
Confirmed User
Industry Role:
Join Date: Aug 2009
Posts: 2,346
|
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.
__________________
![]() ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
Such Fun!
Industry Role:
Join Date: Feb 2008
Posts: 13,900
|
So is there not a rewrite rule, or exclude I do to stop it?
Or give an exception to a certain page etc... ? |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 |
Confirmed User
Industry Role:
Join Date: Jul 2001
Location: 127.0.0.1
Posts: 9,266
|
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
__________________
This post is endorsed by CIA, KGB, MI6, the Mafia, Illuminati, Kim Jong Il, Worldwide Ninjas Association, Klingon Empire and lolcats. Don't mess around with it, just accept it and embrace the truth |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 | |
Such Fun!
Industry Role:
Join Date: Feb 2008
Posts: 13,900
|
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? |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 | |
see you later, I'm gone
Industry Role:
Join Date: Oct 2002
Posts: 14,110
|
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.
__________________
All cookies cleared! |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 | |
Such Fun!
Industry Role:
Join Date: Feb 2008
Posts: 13,900
|
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. |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#12 | |
Confirmed User
Industry Role:
Join Date: Jul 2001
Location: 127.0.0.1
Posts: 9,266
|
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>
__________________
This post is endorsed by CIA, KGB, MI6, the Mafia, Illuminati, Kim Jong Il, Worldwide Ninjas Association, Klingon Empire and lolcats. Don't mess around with it, just accept it and embrace the truth |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#13 |
Such Fun!
Industry Role:
Join Date: Feb 2008
Posts: 13,900
|
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? |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#14 | |
Such Fun!
Industry Role:
Join Date: Feb 2008
Posts: 13,900
|
Quote:
![]() |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#15 |
Confirmed User
Industry Role:
Join Date: Jul 2001
Location: 127.0.0.1
Posts: 9,266
|
btw, are you sure your absolute path isn't wp-content instead of wp-includes?
__________________
This post is endorsed by CIA, KGB, MI6, the Mafia, Illuminati, Kim Jong Il, Worldwide Ninjas Association, Klingon Empire and lolcats. Don't mess around with it, just accept it and embrace the truth |
![]() |
![]() ![]() ![]() ![]() ![]() |