Ryan Paul

is_child WordPress Plugin

This plugin has helped me numerous times… and is a function that I’ve thought should be a part of the WordPress core for a long time.  Anyway… this is not my plugin so I CANNOT give any extra advice or bugfixes.

A colleague of mine – Aaron Affleck – fixed a bug in the ‘is_child_getParents()‘. In the SQL statement, the table name was wrong, the column name trying to be accessed was wrong and the statement was missing an assignment operator.

The original author is Eric Range, and his website has been down for a while. I’m just hosting a copy of the plugin here for everyone else’s use.


Useful for template designers. This plugin checks if current page, posting or category is in direct or recursive relation with a specific parent category or parent page.

Examples:

is_child( 10 )
Checks if the current page, posting or category is somehow
related to category- (or page-)ID 10.

is_child( Example Category, false )
Checks just if the current element is a direct child of Example
Category.

is_child( some-page, 1 )
Checks if the current element (page) is somehow related to a page
with the slug some-page.


Leave a Reply