Skip to content

Instantly share code, notes, and snippets.

@stephenh1988
Created June 22, 2012 12:38
Show Gist options
  • Save stephenh1988/2972527 to your computer and use it in GitHub Desktop.
Save stephenh1988/2972527 to your computer and use it in GitHub Desktop.
Prints in the footer the template being used for that page
<?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