Created
October 19, 2023 13:07
-
-
Save johanguse/604c25f18fcd97bb74b52fe0110676ee to your computer and use it in GitHub Desktop.
Show the page file template name
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
add_filter( 'the_content', 'so_9405896_the_content_filter', 20, 1 ); | |
function so_9405896_the_content_filter( $content ) | |
{ | |
if( is_admin() || !current_user_can( 'administrator' ) ) | |
return $content; | |
global $template; | |
$the_templ = '<strong style="background-color: #CCC;padding:10px">TEMPLATE = ' | |
. basename( $template ) . '</strong><br />'; | |
$content = sprintf( $the_templ . '%s', $content ); | |
return $content; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment