-
AuthorPosts
-
December 1, 2015 at 2:59 pm #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
December 1, 2015 at 3:12 pm #545242Hey 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,
YigitDecember 1, 2015 at 3:45 pm #545290Hi 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,
TimDecember 1, 2015 at 3:47 pm #545294Hey!
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!
YigitDecember 1, 2015 at 3:55 pm #545302Hi 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
December 1, 2015 at 4:01 pm #545313Hi!
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!
YigitDecember 8, 2015 at 11:13 am #548636Hi 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
December 8, 2015 at 1:05 pm #548681Hi!
Sure Tim, we will keep the thread open and wait to hear from you :)
Best regards,
YigitFebruary 22, 2017 at 8:40 pm #750653Hi
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éMarch 3, 2017 at 7:31 am #754864Hi!
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!
IsmaelMarch 3, 2017 at 3:49 pm #755130Hi 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é
March 3, 2017 at 3:56 pm #755134 -
AuthorPosts
- The topic ‘Edit content/text on password protected page’ is closed to new replies.