[wp-hackers] Page Templates vs Category Templates
Mike Schinkel
mikeschinkel at newclarity.net
Thu Dec 2 07:39:21 UTC 2010
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?
Something like (I've not tested this code, it's just the concept):
<?php // category.php
global $wp_query;
$term = $wp_query->get_queried_object();
if (in_array($term->slug,array('a','b','c','d','e','f')))
include "category-1column.php";
else if (in_array($term->slug,array('t','u','x','y','z')))
include "category-4column.php";
I can actually think of at least 5 ways to map the categories to a template file, it is just one of those ways.
Hope this helps.
-Mike
More information about the wp-hackers
mailing list