Created
May 5, 2016 15:58
-
-
Save kellenmace/3630a454aa6a3a30e4ff80b50a5c0a41 to your computer and use it in GitHub Desktop.
Get Page Template for Post in WordPress Admin
This file contains 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 | |
/** | |
* Return true if abc-123 page template is being used, else false. | |
* | |
* @return bool Whether abc-123 page template is being used. | |
*/ | |
function km_is_abc_123_template() { | |
global $post; | |
if ( ! $post ) { | |
return false; | |
} | |
return 'abc-123.php' === get_post_meta( $post->ID, '_wp_page_template', true ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment