• Hi –
    Picking up on a topic that has been touched on – but not clearly resolved – in previous posts, I’m trying to do the following:

    1. add password protection to a specific page (done –> page settings)

    2. override the default wordpress text that is shown when user tries to access the protected page (done –> function my_password_form())

    3. put all of the above in a modal which opens over the selected page rather than in a “holding” page like default wordpress

    I’m using easy modal and have tried to re-work the functions and the php from previous posts, and have made an embarrassing mess of it, as even with a form or a script there is no connection to the page password approval, AND the modal is still appearing on top of the default wordpress page-protection:

    http://fertilitypowerfood.com/zulu/wordpress/trial-quiz-login/ is the sandbox
    pw 123123

    code of shame 😉

    <script>
    function get_the_password_form( $post = 0 ) {
    $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">
    <p>DEFAULT TEXT : This content is password protected. To view it please enter your password below:</p>
    <p><label for="password">Password:<input name="post_password" id="' . $label . '" type="password" size="20" /></label> <input type="submit" name="Submit" value="Submit" /></p></form>
    	        ';
    	        return apply_filters( 'the_password_form', $output );
    	}
    </script>

    Thanks for any suggestions!

  • The topic ‘Modal to enter password for WP password protected page?’ is closed to new replies.