因此,我想补充以下内容:
function foo_function() {
$located = locate_template( \'home.php\' );
if ( !empty( $located ) ) {
// \'home.php\' found in Theme, do something
}
}
add_action(\'init\', \'foo_function\');
// remember to change both of the parameters above, first one for where you want the
// action to happen and the second one the name of the function declared
正如“Chip Bennett”所说,它将检查两个
TEMPLATEPATH
和
STYLESHEETPATH
, 但我会将代码附加到挂钩上,而不是将其放在
functions.php
文件
但这取决于你。