is_tree() function
-
Why isn’t the conditional function is_tree() a CORE part of WordPress? Why do I have to add it to use it?
If you’ve EVER struggled over trying to make dynamic sidebars or includes or any other changes that should propagate to a page and it’s children, check out is_tree(); IT ROCKS and it SHOULD be built into the program by default, imo.
https://codex.www.ads-software.com/Conditional_Tags (scroll down to snippet4)
Here’s the function, but you have to add it to use it per instructions on the Conditionals Tags page:
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 };
Vote here: https://www.ads-software.com/extend/ideas/topic.php?id=3139
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘is_tree() function’ is closed to new replies.