2016-11-17 23 views

回答

0

尝试

<?php echo '<!-- ' . basename(get_page_template()) . ' -->'; ?>

footer.php

它使用get_page_template转储模板名称在注释刻度内 - <!----> - 因此它在源代码中可见但在前端查看器中不可见。

或者使用

<?php get_current_template(true); ?> 

如果你想让它在前端完全可见。

https://developer.wordpress.org/reference/functions/is_page_template/

有一个插件,它提供的功能:https://wordpress.org/plugins/reveal-template/这一个提供了和许多其他调试信息:https://wordpress.org/plugins/debug-bar/

相关问题