Plugin

EE 1
EE 2
GWcode HasChildren

Developer

Leon Dijk - GWcode

3rd Party (Free)

Creative Commons Attribution Non-Commercial No Derivatives

Compatibility

Requirements

  • jQuery for the Control Panel

Tags

This light-weight plugin allows you to check if a category has child categories and then use the result in a conditional. You could for example show some content when a category has child categories and some other content when it doesn't.

First, make sure you call the plugin to check if a category has child categories.
You only have to do this once in the template, somewhere at the top for example:

{exp:gwcode_haschildren:check group_id="1" cat_url_title="{segment_3}"}

Then, you can use conditionals like this in your template:

{if gwcode_haschildren}
	The currently viewed category has child categories! Show something.
{if:else}
	No child categories! Show something else.
{/if}

More information can be found here.

GWcode HasChildren Links

This entry was last updated December 15, 2011, 4:00 am.

Disclaimer: Information about ExpressionEngine add-ons is provided as a service to you, the user, and every member of the ExpressionEngine community. Devot:ee is not responsible if you hose, mangle, wreck, or otherwise destroy your EE website by installing an add-on that you found out about at this site, regardless of its rating, Favorites status, commercial or free status, or general popularity. Caveat EEmptor!

2 Reviews:

Mark Bowen Design 12.16.11

Mark Bowen Design
Rating - {addon_rating_average}

Great little add-on. In the past I’ve had to use the query module in a template to achieve this sort of thing. Have always been meaning to create a plugin to do this and share it with the world but I’m positive Leon’s will always be a million times better than mine ;-) Great work again Leon.

Brian Coult 12.15.11

Rating - {addon_rating_average}

Have to say this is a fantastic little add on that solves the problem of only showing child categories of a parent or if not showing something else.. used to great effect on a photography site i did recently.. great support too