1
A
回答
3
这是我的理解是,密码保护的页面/帖子使用相同的模板是常规页面/帖子。如果您想更改标准信息“我的帖子是密码保护的,请问我输入密码:”,请尝试添加此代码段(将文本更改为您想要的内容)到您主题的function.php文件中:
function fb_the_password_form() {
global $post;
$label = 'pwbox-'.(empty($post->ID) ? rand() : $post->ID);
$output = '<form action="' . get_option('siteurl') . '/wp-login.php?action=postpass" method="post">
<p>' . __("My post is password protected. Please ask me for a password:") . '</p>
<p><label for="' . $label . '">' . __("Password") . ' <input name="post_password" id="' . $label . '" type="password" size="20" /></label> <input type="submit" name="Submit" value="' . esc_attr__("Submit") . '" /></p>
</form>';
return $output;
}
add_filter('the_password_form', 'fb_the_password_form');
-1
在二十三岁的小孩主题中,上述不起作用。相反,我用这个代码(不幸的是,我不记得是谁写的):
<?php
function my_password_form() {
global $post;
$label = 'pwbox-'.(empty($post->ID) ? rand() : $post->ID);
$o = '<form action="' . esc_url(site_url('wp-login.php?action=postpass', 'login_post')) . '" method="post">
' . __("Some custom statement here.\nAnd a second line:\n") . '
<label for="' . $label . '">' . __("Password:") . ' </label><input name="post_password" id="' . $label . '" type="password" size="20" maxlength="20" /><input type="submit" name="Submit" value="' . esc_attr__("Submit") . '" />
</form><p style="font-size:18px;margin:0px; padding: 8px; background: lightblue; height: 40px; width: 400px; text-align: center;">Some other text here</p>
';
return $o;
}
add_filter('the_password_form', 'my_password_form');
?>
相关问题
- 1. WordPress受保护页面密码Cookie
- 2. WordPress的密码保护页面实际上并没有保护
- 3. wordpress密码保护页
- 4. 如何在WordPress中使用自定义模板作为密码保护页面?
- 5. 密码保护获取帖子的页面模板?
- 6. WordPress的:密码保护页(2)
- 7. Cookie不适用于WordPress上的受密码保护的页面
- 8. 记住登录WordPress密码保护页
- 9. 特定页面的密码保护
- 10. AppMaker中受密码保护的页面
- 11. 密码保护生成的PDF页面
- 12. 网站上的密码保护页面
- 13. 阅读受密码保护的页面
- 14. 受密码保护的页面
- 15. 如何在Wordpress上密码保护帖子页面?
- 16. recaptcha卡住在密码保护页面wordpress 4.8
- 17. 密码保护Wordpress MU
- 18. 保护页面模板文件或在MobileFirst中添加验证
- 19. 密码保护CSV文件
- 20. 密码保护Elmah.axd文件
- 21. 你能密码保护html页面吗?
- 22. Node.js/Express密码保护页面
- 23. 密码保护静态页面AppEngine HowTo?
- 24. 使用.htaccess密码保护页面
- 25. 使用唯一密码在Laravel中密码保护页面
- 26. 保护WordPress登录页面
- 27. 在哪里保存页面保护变量?
- 28. 的.htaccess密码保护的文件和
- 29. 如何在wordpress中的密码保护页面中更改登录时间cookie?
- 30. WordPress的页面模板
代码来自https://codex.wordpress.org/Using_Password_Protection – 2017-01-01 09:15:53