i'm trying to implement a custom post template for all posts filed under a specific category.
I'm making use of WP-O-Matic plugin that puts in the RSS feeds in this category and would like to make a bit of customization for the branding on posts filed under this particular category.
I found the below code from here: http://www.nathanrice.net/blog/wordpress-single-post-templates/
But when I add this to my functions.php I get a warning:
Parse error: syntax error, unexpected T_LNUMBER, expecting T_STRING or T_VARIABLE or '{' or '$' in public_html/wp-content/themes/mytheme/functions.php(16) : runtime-created function on line 1
add_filter(
'single_template',
create_function(
'$t',
'foreach( (array) get_the_category() as $cat )
{
if ( file_exists(TEMPLATEPATH . "/single-{$cat->1176}.php") )
return TEMPLATEPATH . "/single-{$cat->1176}.php";
}
return $t;'
)
);
Any idea on how to figure this out.
P.S: I tried using a different approach where I made single.php as a doorway page to run a WP query. If category id matches then it renders custom-template.php else default-template.php
As mentioned here.
But I continue to get the following error:
Parse error: syntax error, unexpected T_LNUMBER, expecting T_STRING or T_VARIABLE or '{' or '$' in public_html/wp-content/themes/mytheme/functions.php(16) : runtime-created function on line 1
Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, '' was given in /public_html/wp-includes/plugin.php on line 166