[wp-hackers] Page Templates vs Category Templates

Mike Little wordpress at zed1.com
Thu Dec 2 10:16:48 UTC 2010


May need to hook locate_templates too...

On 2 December 2010 10:15, Mike Little <wordpress at zed1.com> wrote:

>
>
> 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/
>
>


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


More information about the wp-hackers mailing list