Skip to content

Instantly share code, notes, and snippets.

@gaupoit
Created June 8, 2020 04:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gaupoit/e81890f574cdbfa97873c1b2d5bc5bc6 to your computer and use it in GitHub Desktop.
Save gaupoit/e81890f574cdbfa97873c1b2d5bc5bc6 to your computer and use it in GitHub Desktop.
Customize entire site form
<?php
add_filter( 'ppw_before_return_entire_site_form', 'custom_entire_site_form', 10, 2 );
/**
* Customize entire site login form with more options.
*
* @param string $form The current from in HTML string.
* @param array $options The form options including:
* string logo_content
* string password_label
* string passsword_placeholder
* string button_text Submit button label
* string show_password_text Show password label
* string show_password Showing password checkbox.
* string disable_logo Option to disable logo.
* string form_transparency Option to apply from transparency.
* string is_wrong_password Check whether user entered wrong password.
* string script_show_password JavaScript string to show password.
*
* @return string
*/
function custom_entire_site_form( $form, $options ) {
$is_wrong_password = $options['is_wrong_password'];
return '
<div class="pda-form-login">
<!--Customize your own logo-->
<h1><a>1111</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