Parent or child (wordpress)

Check if a page is parent or child.

<?php
/**
 * Check if a page is parent or child.
 */
function is_tree($pid) {
  global $post;
  if (is_page() && ($post->post_parent==$pid || is_page($pid))) {
    return true;
  } else {
    return false;
  }
};
?>

functions.php

< toolbox