1

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.

1 Answer 1

0

The 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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.