Created
May 8, 2018 14:38
-
-
Save gagimilicevic/2f664e1d788886f1fdd0d54052ad89da to your computer and use it in GitHub Desktop.
Snippet that will let you return the ID of the parent page if the page has a parent.
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 | |
function is_subpage() { | |
global $post; | |
if ( is_page() && $post->post_parent ) { | |
return $post->post_parent; | |
} else { | |
return false; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment