I'm trying to get Wordpress to include a different template file, within single.php, if it sees a file matching the slug.
The file does exits, path is correct, safe_mode set to OFF...am I missing something?
$dir=get_bloginfo('stylesheet_directory').'/post_tmpl/';
$categories=get_categories();
foreach($categories as $cat){
if(is_file($dir.$cat->slug.".php")){
require($dir.$cat->slug.".php");
}else{
require($dir."default.php");
}
}
can you try with this code?
$dir=get_bloginfo('stylesheet_directory').'/post_tmpl/';
$categories=get_categories();
foreach($categories as $cat){
$temp = $dir.$cat->slug;
if(is_file($temp.".php")){
require($temp.".php");
}else{
require($dir."default.php");
}
}
Thanks