PHP 任何孩子的绝对父母

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP 任何孩子的绝对父母相关的知识,希望对你有一定的参考价值。

function is_tree($pid) {	// $pid = The ID of the page we're looking for pages underneath
	global $post;			// load details about this page

	if ( is_page($pid) )
		return true;		// we're at the page or at a sub page

	$anc = get_post_ancestors( $post->ID );
	foreach ( $anc as $ancestor ) {
		if( is_page() && $ancestor == $pid ) {
			return true;
		}
	}
	return false;			// we aren't at the page, and the page is not an ancestor
}

以上是关于PHP 任何孩子的绝对父母的主要内容,如果未能解决你的问题,请参考以下文章