[wp-trac] [WordPress Trac] #33045: New conditional tags for child/parent pages
WordPress Trac
noreply at wordpress.org
Mon Jul 20 10:35:20 UTC 2015
#33045: New conditional tags for child/parent pages
-------------------------+------------------------------
Reporter: ramiy | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Resolution:
Keywords: | Focuses: template
-------------------------+------------------------------
Comment (by ramiy):
{{{
function has_parent() {
global $post;
if ( 0 < $post->post_parent ) {
return true;
} else {
return false;
}
}
function parent_page() {
global $post;
return $post->post_parent
}
function is_child_of( $id ) {
global $post;
if( $id == $post->post_parent ) {
return true;
} else {
return false;
}
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/33045#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list