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