[wp-testers] is_tree with no argument?

Dion Hulse (dd32) wordpress at dd32.id.au
Fri Dec 31 05:20:41 UTC 2010


Then you'll be after Snippet 2:

function is_subpage() {
	global $post;                                 // load details about this  
page
         if ( is_page() && $post->post_parent ) {      // test to see if  
the page has a parent
                return $post->post_parent;             // return the ID of  
the parent post
         } else {                                      // there is no  
parent so...
                return false;                          // ...the answer to  
the question is false
         }
}


On Fri, 31 Dec 2010 06:21:14 +1100, Bryan Harley <bryanharley at gmail.com>  
wrote:

> Can someone help me modify the "is_tree" snippet for the Conditional
> Tags codex page, see:
> http://codex.wordpress.org/Conditional_Tags#Testing_for_paginated_Pages
>
> "is_tree" works great, except that I don't want to be required to
> provide a page ID, currently you HAVE TO:  is_tree('2').  I just want
> it to check dynamically if this is a page or sub-page: is_tree()
>
> Any idea how to do this?
> _______________________________________________
> wp-testers mailing list
> wp-testers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-testers
>


-- 
Dion Hulse / dd32
Contact:
  e: contact at dd32.id.au
  Web: http://dd32.id.au/


More information about the wp-testers mailing list