[wp-hackers] Page Templates vs Category Templates
halukkaramete at gmail.com
Thu Dec 2 05:06:59 UTC 2010
But when you have the category-foobar.php, you've got to name the
category slug as foobar - which is not URL friendly. And that's where
the buck stops. When we stretch the concept a little, we soon see
that approach may lead to dead-ends such as
"Category-sidebar-sidebar-content.php" and obviously that's the end of
Interestingly, pages do not suffer from this problem. Why? Is it
because they got the special functionality that is you could create
any php file and tuck the "Template Name: Something Like Sidebar
Sidebar Content" at its header? And simple there is no room for
category's to be able to benefit from something like that?
Could the post-formats take care of this? I doubt cause the post
formats are addressing the problem at the post level, not at the
I still believe that it is a good feature to enable users so that when
they are creating a new category for a new bunch of post types, they
will be able to pick from a dropdown a layout of choice. But I just
don't see how it can be done with the way Template Hiearchy is, the
way WP is.
Yes, the current structure allows me to come up with
category-videos.php, category-audios.php, category-articles.php but
layout wise, the first two may be using the very same look and feel (
that is one-column no sidebar layout ) , while the 3rd ( the articles
) is using the content + sidebar layout. Even though, I need 2
layouts, I still need 3 category.php's. You may say, why not have the
default category.php to have one column layout then you can stil get
away with 2 category templates. But when you have 100 cats, and 10
different layout options, that idea will not work.
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
On Wed, Dec 1, 2010 at 7:58 PM, Chip Bennett <chip at chipbennett.net> wrote:
> On Wed, Dec 1, 2010 at 9:42 PM, Mike Schinkel
> <mikeschinkel at newclarity.net>wrote:
>> > And interestingly, cats are the 1st group where you need this
>> > kind of flexibility, I think more than the pages... Why should not I
>> > have a no sidebar ( just content layout ) for some of my category
>> > pages... but you look at the themes world, majority provide a
>> > no-sidebar layout only for the pages but cats are totally left alone.
>> > I think this end-result may be trickling down from the out-of-the-box
>> > WP UI which exposes Page layoutsbut not the cat layouts.
>> If you need this functionality today if can be done but would have you
>> implement a Page Template that lists your categories and then you create a
>> Page for this and renamed your category slug something obscure. You may
>> also need to write a bit of PHP to hide tell WordPress your category URL is
>> the URL of the page.
>> Again, it's just not part of WordPress today. But it is doable.
> Unless I'm just completely misunderstanding what you're saying, why would
> you need to do all of that?
> If you know that you will want your category "Foobar" to display full-width
> with no sidebars, you merely need to add a "category-foobar.php" template
> file, in which you remove the sidebars (and add appropriate CSS definitions
> via the body.category-foobar class), and your "Foobar" category posts will
> now display as desired.
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers