I want to place a set of template files in a sub-directory (snippets), so I have this:
<?php include (TEMPLATEPATH '/snippets/file.php'); ?>
But WordPress is showing a blank page.
it works if I remove the sub-directory.
<?php include (TEMPLATEPATH '/file.php'); ?>
Can't find any references in Codex.
Thanks!
I think you are missing a check for the file and the (concatenate) period '.' and you can use include_once if you do not need the file loaded every refresh.
<?php if(file_exists(TEMPLATEPATH .'/snippets/file.php')){include(TEMPLATEPATH .'/snippets/file.php');} ?>
Note:
If it is a child theme then TEMPLATEPATH is the Parent file directory, STYLESHEETPATH is the child's file directory.
<?php if(file_exists(STYLESHEETPATH .'/snippets/file.php')){include(STYLESHEETPATH .'/snippets/file.php');} ?>
David
HI Adeptris,
Thanks so much! It works and thanks for the include_once tips.
Cool mark it as resolved please! :)
Ah yes! Thanks for doing that for me! I didn't even notice there is an option to change a thread status.