I'm working on a sub-directory site of a multisite (e.g. mainsite.domain.com/sub-directory-site). On the main site, I have set up a system where users create posts and depending on what category they are assigned they get different template files (e.g. 'single-11.php' where 11 is the tag_id matching a category).
My problem is that I want to use this same system for the sub-directory-site, but when I try to do this the sub-directory-site post pages don't load their respective 'single-*.php' file. They don't even appear to load the 'single.php' file. All of these files are located within the same theme folder (e.g. .../themes/twentyten/single-11.php).
Currently my mainsite's single post templates are loaded by use of a filter in the functions.php file. It's roughly the following code:
//Gets post cat slug and looks for single-[cat slug].php and applies it
add_filter('single_template', create_function(
'$the_template',
'foreach( (array) get_the_category() as $cat ) {
if ( file_exists(TEMPLATEPATH . "/single-{$cat->slug}.php") )
return TEMPLATEPATH . "/single-{$cat->slug}.php"; }
return $the_template;' )
);
I've searched all over the internet and the WP codex pages and no one seems to have addressed this issue. Either I'm going about this all wrong (probably the case) or I'm not searching properly. Any advice either way would be immensely helpful.