Create functions.php in church to change text on password protected page

Home Forums Omega Child Create functions.php in church to change text on password protected page

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #2571
    jeannie
    Participant

    Hi,
    I’m using the church child theme. I have a password protected page and would like to change the default wp text. My site is http://www.mybedwettingcure.com
    After searching the wp forums, I understand that I need to create an empty functions.php file and add code to it.
    I looked at the files on my admin dashboard and see that there already is a function.php file in church.
    Would I paste the code at the end of that file?
    Here is the code wp says to use:

    function my_password_form() {
    global $post;
    $post = get_post( $post );
    $label = ‘pwbox-‘ . ( empty($post->ID) ? rand() : $post->ID );
    $output = ‘<form action=”‘ . esc_url( site_url( ‘wp-login.php?action=postpass’, ‘login_post’ ) ) . ‘” class=”post-password-form” method=”post”>
    ‘ . __( ‘This content is certainly password protected. To view it please enter your password below:’ ) . ‘

    <label for=”‘ . $label . ‘”>’ . __( ‘Password:’ ) . ‘ <input name=”post_password” id=”‘ . $label . ‘” type=”password” size=”20″ /></label> <input type=”submit” name=”Submit” value=”‘ . esc_attr__( ‘Submit’ ) . ‘” />

    </form>
    ‘;
    return $output;
    }
    add_filter(‘the_password_form’,’my_password_form’);

    Thank you for your help,
    Jeannie

    #2572
    han
    Keymaster

    Hi Jeannie, not at the end, but right before the last closing ?>

    #2578
    jeannie
    Participant

    Thank you Han! Your work on this theme and the child themes is truly a God-send. FYI, when I added the code, I broke my site. It turns out the php code is old and with all the wp updates I needed to use different code. Once I got that figured out, I added the new code where you said and it now works perfectly!
    Thanks again,
    Jeannie

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

You must login to reply to this topic.