check the parent page in wordpress theme

Hay all…
Today, I am going to show how to identify the parent page in wordpress. It’s very easy to do. Just write a 3 line code in page.php file in wordpress.

if(get_pages(array(‘child_of’=>’post_ID’)) || $post->post->parent){
echo “This is the parent page”;
echo “This is not a parent page”;

Save your file and check the page.