[wp-hackers] Page Templates vs Category Templates

Mike Little wordpress at zed1.com
Thu Dec 2 10:15:07 UTC 2010


On 2 December 2010 07:39, Mike Schinkel <mikeschinkel at newclarity.net> wrote:

>
> On Dec 2, 2010, at 12:06 AM, Haluk Karamete wrote:
> > We should be able to group categories as far as layouts as well. For
> > exammple, categories a,b,c,d,e,f will use 1 column lay out and cats
> > t,u,x,y,z will use 4 column layout. Is that somehow possible? If so
> > how?
>
>
How about:

"some UI in the theme to associate your categories with provided templates"

the theme stores $cat_mappings[category-foo.php'] =>
'no-sidebar-template.php';
and $cat_mappings[category-bar.php'] => 'no-sidebar-template.php';
and $cat_mappings[category-bop.php'] => 'left-sidebar-template.php';

Then hook on 'category_template' filter:

add_filter('category_template', 'map_category_templates');
function 'map_category_templates'($template) {
    if (isset($cat_mappings[$template]) )
        return $cat_mappings[$template];
    return $template;
}


Mike
-- 
Mike Little
http://zed1.com/


More information about the wp-hackers mailing list