Category template question
-
I had a quick question:
I’m trying to use WordPress as a CMS. A blog is integrated as part of the site, but it’s not the *main* part of the site. So I’m relegating all “blog” stuff to a single category, which will list categories beneath that main “blog” category.
Now, under this main category, I would like *any* posts that fall under it to have the same template. So I’ve used:
<?php if (is_category('blog-posts') || in_category('blog_posts') { ?>it works *okay*… it’s kind of halfway there. But if you go to a post in a subcategory of “blog-posts”, the layout changes back to the default – which I don’t want. I want the “blog-posts” category – and all the subcategories – to have the same layout. Now, I *thought* that the “in_category” would take care of that (seeing as how the posts will be marked with 2 categories: “blog-posts” *and* whatever subcategory it’s in) – but it doesn’t. I know why, too, and I totally understand why it works that way – just something I didn’t think of, I guess.
Now, the possibilities of adding in subcategories are endless, so I’d like to do something a teensy bit more “automated” than adding in another
is_category('whatever')every single time a new one is created. I’d just like it if, when a subcategory to “blog-posts” is added, it immediately takes on the layout for the parent category. (I’ve also already thought of making my category the default and doing conditional for the rest, but we’re back to the same problem, because many static page categories can also be added – so either way, I’m screwed.)What am I missing? A poke in the eye with the right answer (or direction *to* the right answer) would be great. I’m starting to think I’ll need to custom-write something though – so if there’s already an existing…well *anything* for this, that’s be great too. In the meantime, I’ll keep looking.
Thanks for any help anyone can offer 🙂
The topic ‘Category template question’ is closed to new replies.