[wp-hackers] categories with no childs
capsx
capsx at team.lv
Mon May 31 07:49:46 UTC 2010
thx a lot
it is what i needed!
:)
On Sun, 30 May 2010 11:19:04 +1000
"Dion Hulse (dd32)" <wordpress at dd32.id.au> wrote:
> On Sun, 30 May 2010 09:17:43 +1000, Charles K. Clarkson
> <cclarkson at htcomp.net> wrote:
>
>> Dion Hulse (dd32) wrote:
>>
>> : capsx wrote:
>>
>> : : which is the easiest way to get wordpress categories
>>with no child
>> : : categories?
>>
>> : $terms_Without_children = get_terms('category',
>>array('hide_empty' =>
>> false,
>> : 'parent' => '0', 'exclude' => $terms_with_children ));
>> : // Fetch terms with a Parent of 0 (ie. top level),
>>which are not in
>> : the list of terms with known children
>>
>> That looks like a better solution, but what about child
>>categories
>> (not top level) which have no child categories? Why the
>>top level
>> category restriction?
>
> My understanding was that the original question was for
>top level categories without children.
> If you remove 'parent' => 0 from the get_terms call,
>you'll get all categories without children, I just
>thought that seemed a bit strange myself..
>
> But theres no technical reason why you -have- to exclude
>non-top-level categories.
>
> Cheers
> Dion Hulse / dd32
> Contact:
> e: contact at dd32.id.au
> Web: http://dd32.id.au/
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
-nonse response-
More information about the wp-hackers
mailing list