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.



  1. Wonderful beat ! I would like to apprentice while you
    amend your web site, how could i subscribe for a blog website?
    The account helped me a acceptable deal. I had been tiny bit acquainted of this your broadcast provided bright clear concept

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s