Categories

Reveal Template

Author:Scott Reilly
Version:1.0
Last update:12 Apr 2009
Compatibility:WP 2.6+, 2.7+
Comments:go here
Download:[ zip ]
Description:

Reveal the theme template file used to render the displayed page (for debugging purposes).

Extended Description

Reveal the theme template file used to render the displayed page (for debugging purposes). By default this appears in the site’s footer.

Designers and developers know that it can sometimes be confusing and frustrating to determine the exact template being utilized to render the currently displayed page in WordPress. Sometimes page or category specific templates exist, or a page/post has been set by the post author to use a particular template, or the current theme doesn’t employ certain templates causing WordPress to fall back to others.

This plugin relieves the aggravation by assisting designers and developers by displaying the template being used to render the currently displayed page in WordPress. This typically appears in the site’s footer (though only if the theme follows the recommended practice of calling the wp_footer() template tag) at some point. Also, obviously this can only universally apply to the site if said footer is actually used on every page.

A template tag is also provided which can be used to display the template file.

<?php reveal_template(); ?>

By default, reveal_template() will echo the template name. To simply retrieve the template filename rather than displaying it:

<?php $template = reveal_template(false); ?>

The template tag also takes a second argument which be can be one of the following: absolute, relative, template-relative, filename. This determines the path style you’d like reported. If not specified, it uses the default defined in the plugin’s settings page.

Examples of path types:
* “absolute” : /usr/local/www/yoursite/wp-content/themes/yourtheme/single.php
* “relative” : wp-content/themes/yourtheme/single.php
* “template-relative” : yourtheme/single.php
* “filename” : single.php

This plugin is primarily intended to be activated on an as-needed basis.

Read the readme.txt.

Installation

  1. Unzip reveal-template-v1.0.zip inside the /wp-content/plugins/ directory for your site
  2. Activate the plugin through the ‘Plugins’ admin menu in WordPress
  3. Optionally customize the plugin’s settings by click the plugin’s ‘Settings’ link next to its ‘Deactivate’ link (still on the Plugins page), or click on the’Design’ -> ‘Reveal Template’ link, to go to the plugin’s admin settings page.

Template Tag

This plugin provides 1 template tag(s).

Function

reveal_template($echo = true, $template_path_type = '')

Displays links to each of any number of tags specified via tag IDs and/or slugs

Arguments

  • $echo : (optional) A boolean value (either true or false) to indicate if the template should be displayed on the page. By default this is true.
  • $template_path_type : (optional) Indicates the format of the path. If not specified, then the default configured via the plugin’s settings page is used. See documentation above for examples. Can be one of the following: absolute, relative, template-relative, filename

Release Log

Copyright & Disclaimer

Copyright © 2008-2009 by Scott Reilly (aka coffee2code)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.