Skip to content

Instantly share code, notes, and snippets.

@tdrayson
Created October 15, 2020 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tdrayson/b29a7c4515ddb37002ad47520bec5692 to your computer and use it in GitHub Desktop.
Save tdrayson/b29a7c4515ddb37002ad47520bec5692 to your computer and use it in GitHub Desktop.
<?php
/**
* Function to check if the current Page is a parent or not.
* @return bool true (1) if the current Page has children else false (0)
*/
function wpdd_is_parent_page() {
// Load details about this page.
$post = get_post();
$children = get_posts(array('child_of' => $post->ID, 'post_type' => 'service')) ;
return is_single() && count( $children ) > 0;
}
//Add wpdd_is_parent_page as dynamic data to conditions = 1
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment