When I password protect a page under privacy settings for that page (laughingbearranch.com/resources) is there a way to customize the page which appears asking for input of the password? I’d like to add some different copy and also shorten the field for the password to be input.
Thanks, kindly. Jen
Hey AirstreamCoach!
Please add following code to Quick CSS in Enfold theme options under General Styling tab
.post-password-form input {
max-width: 30%;
}
and then add following code to functions.php file
add_filter( 'the_password_form', 'custom_password_form' );
function custom_password_form() {
global $post;
$label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID );
$o = '<form class="protected-post-form" action="' . get_option('siteurl') . '/wp-pass.php" method="post">
' . __( "This post is password protected. To view it please enter your password below:" ) . '
<label for="' . $label . '">' . __( "Password:" ) . ' </label><input name="post_password" id="' . $label . '" type="password" size="20" /><input type="submit" name="Submit" value="' . esc_attr__( "Submit" ) . '" />
</form>
';
return $o;
}
Best regards,
Yigit
This is a really old thread but I just realized I never solved this problem. I tried the code but it did not work. The password field still goes across the whole width of the page. Is there a way to customize the field length? thanks.
Hey!
Please try the below code in Enfold > General Styling > Quick CSS
#top input[type='password'] {
max-width: 30%!important;
}
@media only screen and (max-width: 768px) {
#top input[type='password'] {
max-width: 100%!important;
}
}
Cheers!
Vinay Kashyap