質問

For example I have term 'child', how to check do this term is child of term 'Mother' ?

役に立ちましたか?

解決

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/

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top