-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustom-password-form.php
More file actions
30 lines (26 loc) · 1.21 KB
/
custom-password-form.php
File metadata and controls
30 lines (26 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
/**
* Custom Password Form. WordPress Allows Pages/Posts to be protected via a password
* set in the Admin Dashboard. The page needs to implement a call to the method get_the_password_form()
* This filter allows us to override the default form with custom markup
*/
add_filter('the_password_form', 'custom_password_form');
function custom_password_form()
{
global $post;
$label = 'pwbox-' . (empty($post->ID) ? rand() : $post->ID);
$o = '<div class="custom-password-form" >
<form class="protected-post-form" action="' . get_option('siteurl') . '/wp-login.php?action=postpass" method="post">
<div style="margin: 0 auto;">
' . __("This Content is protected") . '
<label class="pass-label" for="' . $label . '">' . __("PASSWORD") . ' </label>
<input name="post_password" id="' . $label . '" type="password" size="20" />
<input type="submit" name="Submit" class="button" value="' . esc_attr__("Submit") . '" />
</div>
</form>
<br/>
<p class="alert" > ∗∗ Remember, this is a different password than the account password</p>
</div>
';
return $o;
}