Created
May 7, 2015 08:11
-
-
Save matesnippets/7778392bd52d9cc82a99 to your computer and use it in GitHub Desktop.
Check if page is a child of, takes a page ID
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 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