Created
March 22, 2012 05:38
-
-
Save smonteverdi/2156440 to your computer and use it in GitHub Desktop.
WordPress: Customize password protected message
This file contains 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( '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; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment