Is there a native function to check if a theme a template file. For instance, if a theme is not using the ‘home.php’ file, then execute some code…
Leave a Reply
You must be logged in to post a comment.
Is there a native function to check if a theme a template file. For instance, if a theme is not using the ‘home.php’ file, then execute some code…
You must be logged in to post a comment.
So I would add to the Answer the following:
As @Chip Bennett, said it will check both
TEMPLATEPATH
andSTYLESHEETPATH
, but I would append the code to a hook instead of just putting it in thefunctions.php
file.But’s up to you.
Any reason
locate_template()
(Codex ref) wouldn’t work?Note that
locate_template()
will check both TEMPLATEPATH and STYLESHEETPATH, so it works for both a stand-alone Theme and a Child Theme.