[wp-hackers] Should child category selection auto-select the
parent category?
Steve
korgan at de-generationx.net
Tue Jul 13 17:07:02 UTC 2004
Tara Star wrote:
> Doug Daulton wrote:
>
>> WP's child categories are brilliant. My only question is ...
>>
>> Should child category selection auto-select the parent category?
>>
>> For example, if I have the following structure:
>>
>> - Monkeys and Apes
>> - Gorillas
>> - Chimps
>> - Spider Monkeys
>>
>> - Big Cats
>> - Tigers
>> - Lions
>> - Leopards
>>
>> If I select "Tigers" should'nt WP automatically assign that post to
>> "Big Cats" as well? If this is not the default, shouldn't it be an
>> option which gets set globally by the admin ?
>
>
> I wouldn't autoselect. Anyway, the way it is set up now, if you view
> "Big Cats", WP includes posts which are filed under the children
> categories.
>
> What I would really like, however, is a way of listing the posts which
> are in "Big Cats" itself, without those who are in the children
> categories.
>
> Something like an optional checkbox on the category page or a "show
> subcats" "hide subcats" toggle link?
>
> Steph aka bunny
What about just creating a simple new function that checks if the
Category Parent field from the database/$post is anything other than 0.
So you'd be able to go
// Inside the loop
<?php if (!$subcategory($post)) {
// Whatever you here
}?>
That way you wouldn't have to change anything and could easily do it as
a plugin or even a hack.
More information about the hackers
mailing list