Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #21653

    How do I edit the default text “This post is password protected. To view it please enter your password below:” on password protected pages for this theme? I would like to provide visitors with information on how to request a new password.

    After researching online, I found that I needed to add the following code to the functions.php file:

    // Password Protected Page Message

    function custom_password_form($form) {

    $subs = array(

    ‘#<p>This post is password protected. To view it please enter your password below:</p>#’ => ‘<p>Hopefully this works.</p>’,

    ‘#<form(.*?)>#’ => ‘<form$1 class=”passwordform”>’,

    ‘#<input(.*?)type=”password”(.*?) />#’ => ‘<input$1type=”password”$2 class=”text” />’,

    ‘#<input(.*?)type=”submit”(.*?) />#’ => ‘<input$1type=”submit”$2 class=”button” />’

    );

    echo preg_replace(array_keys($subs), array_values($subs), $form);

    }

    add_filter(‘the_password_form’, ‘custom_password_form’);

    Unfortunately this did not work. Please let know the best way to make these edits.

    Thanks.

    #112600

    Hey!

    The codex article might help you: http://codex.wordpress.org/Using_Password_Protection#Customize_the_Protected_Text

    Regards,

    Peter

    #112601

    Thanks for your help Peter. That worked!

    #112602

    Glad Peter could help :)

    Let us know if you have any other questions or issues.

    Regards,

    Devin

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Edit text on password-protected page’ is closed to new replies.