Last active
September 29, 2017 11:35
-
-
Save BHWD/ffb263fa3c5071304cc1a88adf05b044 to your computer and use it in GitHub Desktop.
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
<?php | |
/* Place this within the themes functions.php file */ | |
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 | |
}; | |
/* Use this within the page templates */ | |
if (is_tree(2)) { | |
// stuff | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment