How can I return the pathname from the current file, only 2 directories up?
So if I my current file URL is returning theme/includes/functions.php
How can I return "theme/"
Currently I am using
return dirname(__FILE__)
PHP 7
return dirname(__FILE__, 2);
PHP 4 and higher
return dirname(dirname(__FILE__));
With PHP7 you can get further up the directory tree by specifying the levels parameter, while pre-7 PHP will require further nesting of the dirname
function.