Created
June 22, 2012 12:38
-
-
Save stephenh1988/2972527 to your computer and use it in GitHub Desktop.
Prints in the footer the template being used for that page
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 | |
/** | |
* Plugin Name: SH Which Template Is This | |
* Description: Prints in the footer the template being used for that page. | |
* Author: Stephen Harris contact@stephenharris.info | |
* Author URI: http://stephenharris.info | |
* License: GPL | |
* License URI: http://www.gnu.org/copyleft/gpl.html | |
*/ | |
class SH_Which_Template_Is_This{ | |
static $template=''; | |
static function load(){ | |
add_filter('template_include', array(__CLASS__,'template_include'),9999 ); | |
add_action('wp_footer',array(__CLASS__,'wp_footer')); | |
} | |
static function template_include($template){ | |
self::$template = $template; | |
return $template; | |
} | |
static function wp_footer(){ | |
if( !empty(self::$template) ){ | |
echo 'Current template is '.self::$template; | |
} | |
} | |
} | |
SH_Which_Template_Is_This::load(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment