For example I have term 'child', how to check do this term is child of term 'Mother' ?
Asked
Active
Viewed 174 times
0
-
1DNA test..oops....sorry but I am unable to get urs ..what exactly u want and how it is relevant to wordpress..post/category etc hierarchy or something else ur looking for ? – swapnesh Feb 26 '13 at 19:54
-
Yep herarchy, looking for function like `is_child()` ;D – Wizard Feb 26 '13 at 19:56
-
1Check this if this is what something you are looking for http://bavotasan.com/2009/check-if-a-page-is-a-child-of-another-page-in-wordpress/ – swapnesh Feb 26 '13 at 19:59
-
Yes I looking for this, please write post, I will mark It as answer ;) – Wizard Feb 26 '13 at 20:19
1 Answers
1
As per your comments I think you can do this in the below mentioned manner -
Place this method in your theme functions.php
file
function is_child($pageID) {
global $post;
if( is_page() && ($post->post_parent==$pageID) ) {
return true;
} else {
return false;
}
}
Then you can use this method anywhere in your theme --
<?php
if(is_child(343)) {
echo "This is a child page of 'The Parent Page Title'.";
}
?>
Reference - http://bavotasan.com/2009/check-if-a-page-is-a-child-of-another-page-in-wordpress/

swapnesh
- 26,318
- 22
- 94
- 126