Page has parent

<?php

//Function for the functions.php file
function is_child($pageID) {
global $post;
if( is_page() && ($post->post_parent==$pageID) ) {
return true;
} else {
return false;
}
}

//Code to check parenthood for template file
if(is_child(343)) {
echo "This is a child page of 'The Parent Page Title'.";
}

0 Comments

You must be logged in to post a comment.