How to customize password protection form?
-
At http://www.dragontrainings.com, I’m using a child theme of twentythirteen. I’ve added a functions.php file to the child theme folder. Following advice found elsewhere, I entered and tested this function:
<?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"> ' . __( "You must be accepted into the training to access this page.\nPlease enter the password you were given:\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:14px;margin:0px;">∗EXTRA TEXT CAN GO HERE...THIS WILL SHOW BELOW THE FORM</p> '; return $o; } add_filter( 'the_password_form', 'my_password_form' ); ?>
This code, which I think predates 2013, doesn’t work, and it breaks the wp-admin page, getting “already loaded” errors. So, I had to rename the functions.php file to get back into the site.
Suggestions welcome!
- The topic ‘How to customize password protection form?’ is closed to new replies.