Last active
June 8, 2020 03:30
-
-
Save gaupoit/02de4e5d97a1597e3ac68f57983c0590 to your computer and use it in GitHub Desktop.
Customize WordPress Password Form - Entire Site
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'ppw_custom_entire_site_login_form', 'custom_login_form' ); | |
function custom_login_form() { | |
$is_wrong_password = isset( $_GET['action'] ) && $_GET['action'] === 'ppw_postpass' && isset( $_POST['input_wp_protect_password'] ) ? 'display: block' : 'display: none'; // Do not remove it. This helps to check whether the user entered password correctly. | |
return ' | |
<div class="pda-form-login"> | |
<!--Customize your own logo--> | |
<h1><a></a></h1> | |
<!--parameter action=ppw_postpass to bypass cache--> | |
<!--parameter wrong_password=true to show message wrong password--> | |
<form action="?action=ppw_postpass" method="post"> | |
<label for="">Password</label> | |
<!--Required input tag with name="input_wp_protect_password"--> | |
<input class="input_wp_protect_password" type="password" id="input_wp_protect_password" name="input_wp_protect_password"> | |
<!-- Customize your error message here --> | |
<p id="ppw_entire_site_wrong_password" style="' . $is_wrong_password . '" class="ppw_entire_site_password_error">' . esc_html__( apply_filters( PPW_Pro_Constants::HOOK_CUSTOM_MESSAGE_WRONG_PASSWORD_ENTIRE_SITE, 'Please enter the correct password!' ), 'password-protect-page' ) . '</p> | |
<input type="submit" class="button button-primary button-login" value="Login"> | |
</form> | |
<!-- Add your T&C or custom statements here --> | |
</div> | |
'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment