2014-11-24 57 views
-2

我创建一个wordpress主题从头开始,并在我的wordpress functions.php文件中使用以下功能可以样式保护帖子。WordPress的白色死亡屏幕从我的functions.php

的代码,从这里拍摄 - tutsplus

但是代码每次我试图登录到后台或更新的帖子给我的白色屏幕。任何意见,我可能会错过这里将不胜感激。

<?php 
add_filter('the_password_form', 'custom_password_form'); 
function custom_password_form() { 
    global $post; 
    $label = 'pwbox-'.(empty($post->ID) ? rand() : $post->ID); 
    $o = '<div id="protected"> 
     <form class="protected-post-form" action="' . get_option('siteurl') . '/wp-login.php?action=postpass" method="post"> 

    <div class="padlock"></div> 
    ' . __("You'll need a password to get in here") . ' 
    <label class="pass-label" for="' . $label . '">' . __("PASSWORD:") . ' </label><input class="post_password" name="post_password" id="' . $label . '" type="password" placeholder="Password"/><input type="submit" name="Submit" class="button" value="' . esc_attr__("Submit") . '" /> 
    </form></div> 
    '; 
    return $o; 
} 
?> 

编辑 - 删除的主题和玩耍后,错误肯定是在这个.functions.php文件,我只是不确定其中

+0

死亡白屏表示您需要打开调试(无论是在PHP级别还是在WordPress级别)。详细的错误输出将非常有帮助。 – rnevius 2014-11-24 09:02:27

+0

请激活调试:http://codex.wordpress.org/Debugging_in_WordPress许多地方出现错误可能来自。在qick视图之后,我看到你有一个'未转义的字符',你会需要一个密码',我认为这会破坏你的代码。 – 2014-11-24 09:03:08

回答

0

确保没有开启之前没有空行来自functions.php。