include/require a file from another directory
-
So I’ve tried everything I know to include/require a file from another directory within my wordpress install.
Below is what I’ve tried can anyone tell me what I’m missing
Move back through folder to the proper dir:
include(../../../myfolder/myfile.php)
setting root path:
include($_SERVER['DOCUMENT_ROOT']."/services/charigfy.php")
Hardcoding path:
include(/home/mylogin/public_html/myfolder/myfile.php)
These are just a few of the many. The folder is two folder back from my theme folder. Coming the other way its 1 folder deep past root.
each time I get the error below:
Warning: include(/home/mylogin/public_html/myfolder/myfile.php) [function.include]: failed to open stream: No such file or directory in /home/example/public_html/wp-content/themes/my_theme/home.php on line 13Its trying to add on the path to the end of home.php which of course won’t work it doesn’t exist. I’m aware normally you would ../../ however many directories you need to go back but that just isn’t working.
What am I missing?
- The topic ‘include/require a file from another directory’ is closed to new replies.