它可以在HTML源代码这样被打印:
add_action('wp_head', 'so_9405896_show_template', 999);
function so_9405896_show_template() {
global $template;
echo '
<!--
TEMPLATE = ' . basename($template) .'
-->
';
}
或者为了便于可视化,直接在内容与此:
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;
}
这导致:
所以是我,我想知道是否有一种方法,以编程方式输出它的地方,所以我可以找到页面,而无需去打开每个文件并键入它。 – Jason 2012-10-18 19:22:51