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 <[email protected]> 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
[email protected]
http://lists.automattic.com/mailman/listinfo/wp-testers



--
Dion Hulse / dd32
Contact:
 e: [email protected]
 Web: http://dd32.id.au/
_______________________________________________
wp-testers mailing list
[email protected]
http://lists.automattic.com/mailman/listinfo/wp-testers

Reply via email to