admin管理员组文章数量:1387323
I working on my plugin and tried to override some templates.
If I visit the page portfolio my screen gives a whitepage.
This is my code
define("PLUGIN_DIR_PATH", plugin_dir_path(__FILE__));
add_filter( 'template_include', 'plugin_tweak_template', 99);
function plugin_tweak_template( $template ) {
if ( is_page('portfolio')) {
$template = PLUGIN_DIR_PATH . 'required/templates/portfolio.php';
}
return $template;
}
I use this code in my plugin root file.
I working on my plugin and tried to override some templates.
If I visit the page portfolio my screen gives a whitepage.
This is my code
define("PLUGIN_DIR_PATH", plugin_dir_path(__FILE__));
add_filter( 'template_include', 'plugin_tweak_template', 99);
function plugin_tweak_template( $template ) {
if ( is_page('portfolio')) {
$template = PLUGIN_DIR_PATH . 'required/templates/portfolio.php';
}
return $template;
}
I use this code in my plugin root file.
Share Improve this question asked Apr 14, 2020 at 21:59 SebasSebas 132 bronze badges1 Answer
Reset to default 0The white screen means that you have a critical error that is halting execution, but you do not have PHP messaging turned on to tell you what that error is.
Turn on debug mode in WordPress so the error message is displayed. Otherwise you don't have enough information to correct your problem. Set the WP_DEBUG
constant in your wp-config.php
file to true
. See: Debugging in WordPress
Once you know what that error is, you can edit your question with more information.
本文标签: pluginsWhite page by using filter templateinclude
版权声明:本文标题:plugins - White page by using filter template_include 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744567748a2613155.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论