Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #545222

    Hi!

    I would like to customize the default content on the password protected page in Enfold. I want to change the default text (“This content is password protected. To view it please enter your password below:”), but preferably also the page layout, reduce the width of the password box and add other content, for instance images.
    I tried the solution on https://kriesi.at/support/topic/edit-text-on-password-protected-page-2/ ,adding the filter to my functions.php (of my Enfold Child Theme) however when I click save I immediately get a 500 server error. (the only way to restore was to remove the code from functions.php using FTP).
    I suspect this filter is not compatible with WP 4.3.1/Enfold 3.4.3 or (more likely) I am doing something wrong.

    Thanks,

    Tim

    #545242

    Hey timhollander!

    I moved

    add_filter( 'the_password_form', 'custom_password_form' );

    part of the code to the bottom and it helped. Please review your website now

    Best regards,
    Yigit

    #545290

    Hi Yigit,

    Thanks for your quick response.

    So the complete code part now reads:

    function custom_password_form() {
    global $post;
    $label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID );
    $o = '<form action="' . esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ) . '" class="post-password-form" method="post">' . __( "You can write your own text here" ) . '
    <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;
    }
    add_filter( 'the_password_form', 'custom_password_form' );

    which means the password protected page should now say “You can write your own text here” in stead of “This content is password protected. To view it please enter your password below:”. However it doesn’t.

    should I add anything else to make it work?

    Thanks,
    Tim

    #545294

    Hey!

    Please flush browser cache and refresh your page a few times after making the changes. It does work fine on my end. Screenshot in private content field below

    Cheers!
    Yigit

    #545302

    Hi Yigit,

    Yes, I see it now! Apparently I was too quick ;) Thanks a lot for your help!
    Next step: is there any way to change the layout of the page or add media content? (I’m a PHP noob)

    Tim

    #545313

    Hi!

    Can you please elaborate on the changes you would like to make? You can simply apply them by adjusting the code in functions.php file. It is not really a layout. It replaces the content if it is password protected.

    Cheers!
    Yigit

    #548636

    Hi Yigit,

    Thanks again for the help. I will try to add content by adding some code in the functions.php. If I don’t succeed I will let you know.

    Tim

    #548681

    Hi!

    Sure Tim, we will keep the thread open and wait to hear from you :)

    Best regards,
    Yigit

    #750653

    Hi
    In every thread I only found the solution to change text on password protected pages. But how can I change the text on the Blog Mainpage? I used for the blog homepage avia layout architekt and use the content element “Blog Beiträge” with an excerpt. On the Main Page there’s this text for protected content (german sorry):
    “Es gibt keine Kurzfassung, da diese ein geschützter Beitrag ist.” (see Page)
    I want to add something like “Please write me to send you a password” already here, and not only on the blog page itself.

    Thanks to give me advice where to change.
    René

    #754864

    Hi!

    Where can we find that text (Es gibt keine Kurzfassung, da diese ein geschützter Beitrag ist.) ? Could you please provide the actual link to the page? I can’t find it anywhere.

    Cheers!
    Ismael

    #755130

    Hi Ismael

    Meanwhile, my solution was like that:

    1. Use the language plugin “loco translate”
    2. changed translation in german in my own words (because the site is only in german)

    So for me, the problem is solved on the startpage of https://www.dreamwhisperer.ch. (if you scroll down, you’ll see it)

    Thanks anyway for your help. I’m still a fan of Enfold!

    René

    #755134

    Hi!

    Glad you figured it out and thanks for sharing your solution!
    And, sorry for the late reply :)
    Let us know if you have any other questions or issues!

    Regards,
    Yigit

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘Edit content/text on password protected page’ is closed to new replies.