I'm a new WordPress developer and recently I've been having problems (on multiple sites) with
require_once for PHP files. If I include
(get_theme_directory_uri() . 'subdir/file') the specified file gets included (or required, which leads to fatal errors) but if any WordPress functions are called within 'file' I get something similar to:
'Call to undefined function
The apparent solution I've found is to do:
include(dirname(__FILE__) . "/subdir/filename");
Is this right or did I miss 'the WordPress way' to include files somewhere?