Created
April 30, 2014 15:00
-
-
Save dannyconnolly/fd18584d02c898b5fd91 to your computer and use it in GitHub Desktop.
Check if page is parent, child in wordpress
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
function is_tree($pid) { | |
// $pid = The ID of the page we're looking for pages underneath | |
global $post; | |
// load details about this page | |
if(is_page()&&($post->post_parent==$pid||is_page($pid))) | |
return true; // we're at the page or at a sub page | |
else | |
return false; // we're elsewhere | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment