Skip to content

Instantly share code, notes, and snippets.

@matesnippets
Created May 7, 2015 08:11
Show Gist options
  • Select an option

  • Save matesnippets/7778392bd52d9cc82a99 to your computer and use it in GitHub Desktop.

Select an option

Save matesnippets/7778392bd52d9cc82a99 to your computer and use it in GitHub Desktop.
Check if page is a child of, takes a page ID
/**
* Check if a a page is child of a given ID
*
* @link(_blank, http://bavotasan.com/2011/is_child-conditional-function-for-wordpress/)
* @param int $page_id The parent page id to check
* @return bool
*/
function n26_is_child($page_id) {
global $post;
if (is_page() && ($post->post_parent == $page_id)) {
return true;
} else {
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment