WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] edit password protected post text (9 posts)

  1. jazfotodesign
    Member
    Posted 3 years ago #

    http://www.spiritgrowth.com/?p=315

    I can't find anywhere to edit a password protected post

    "This post is password protected. To view it please enter your password below:"

    which file is it in? thanks

  2. rachaely
    Member
    Posted 3 years ago #

    Are you the admin or user of this site?

    If you're the user, you won't be able to see the post unless you enter the password you've been supplied.

    If you're the admin, you should be able to edit the post via the admin panel at http://www.spiritgrowth.com/wp-admin/

    Good luck!

  3. alchymyth
    Forum Moderator
    Posted 3 years ago #

  4. jazfotodesign
    Member
    Posted 3 years ago #

    cool the following code worked.

    <?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;
    }
    ?>

    How can I put a link where the bold text is? <a href="link">doesn't work

    $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:" ) .
    `

  5. alchymyth
    Forum Moderator
    Posted 3 years ago #

    $o = '<form class="protected-post-form" action="' . get_option('siteurl') . '/wp-pass.php" method="post">
    	' . '<a href="link">' . __( "This post is password protected. To view it please enter your password below:" ) . '</a>' . '
    	<label for="'
  6. jazfotodesign
    Member
    Posted 3 years ago #

    thank you alchymyth, very helpful :)

  7. Orin
    Member
    Posted 3 years ago #

    I wrote a plugin which will do just this, but without having to modify your core files. You can safely upgrade and not break your modifications:

    Protected Post Personalizer

  8. jazfotodesign
    Member
    Posted 3 years ago #

    Orin, can your plug-in customize individual posts or does it just change what it says for all of them?

  9. Orin
    Member
    Posted 3 years ago #

    @jazfotodesign It does change the "Protected:" text site-wide, but you can easily remove that text entirely and instead simply title your posts things like "Password Required: New Pictures".

Topic Closed

This topic has been closed to new replies.

About this Topic