Created
December 19, 2017 12:27
-
-
Save morgyface/cbcefadbf0dd9ed331b603ef8289a95c to your computer and use it in GitHub Desktop.
WordPress | Function | Return the name of the template the posts parent uses
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 parent_template() { | |
| global $post; | |
| $parent_id = wp_get_post_parent_id( $post->ID ); | |
| $parent_template_name = get_page_template_slug( $parent_id ); | |
| return $parent_template_name; | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment