So, I have a snippet of code I'd like to tidy away in a directory that's close to the root my wordpress directory. Specifially it lives in /includes/inc.
I've created a file called test.php and within it it simply says echo "XXXX";
All I currenly want to be able to do is include this file in my functions.php file and see the sting printed to the screen.
The issue I'm seeing is that no matter what path I put into require, the page break. Even no path at all breaks the page. I'm 100% sure this is the correct path as well.
Why might this be happening?
Inside the functions.php file at the very top, below comments.
require('/inc/test.php');
Inside the test.php file inside /inc within the theme folder:
echo "TEST XXXXXX";
I've tried using * require_once * require * include (just does nothing) * include_once (same as include - does nothing)
/includes/inc/
but you are trying to load/inc/test.php
. Theincludes
part of the path is missing. A bad path forrequire()
will be a fatal error. – s_ha_dum Nov 24 '15 at 9:24