-
AuthorPosts
-
April 10, 2014 at 7:52 pm #249908
I need to change the default text on a password protected page in Enfold. I have tried using the code in the WP Codex, but it breaks the site in a big way. I’m not a PHP coder, so what might the EXACT code be to put in the functions.php file (something I can just paste at the end) that would make it work and not immediately crash the site. Usiing the latest WordPress and Enfold as of 4/10/14.
Or is there a way to make a secondary functions file just for this? Please use language that a novice can understand.
Thanks!
April 11, 2014 at 1:56 am #250013Hi stefanbean!
Please go to Appearance > Editor and open Functions.php file and find
avia_nav_menus(); //call the function immediatly to activate }
and add following code right below it
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"> ' . __( "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; }
Regards,
YigitApril 11, 2014 at 8:30 pm #250369Yigit,
First time I pasted the code from my e-mail notification. Big giant error. Tried again pasting directly from your post and it worked great.
Having the right code and even better the perfect insertion spot made all the difference.
Thanks!
April 11, 2014 at 9:19 pm #250380I spoke too soon. The ability to change the text is there, but when you put in the password and submit, you get a 404 page not found error. It’s not remembering the page it needs to go to.
Help again.
Sam
April 14, 2014 at 9:16 am #250952Hi!
I think they changed the code with WP3.8. Please try this code instead:
add_filter( 'the_password_form', 'custom_password_form' ); 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; }
and replace “You can write your own text here” with your custom text. Ref: http://forum.wpde.org/allgemeines/124403-wp-3-8-passwort-text-aendern.html
Best regards,
PeterDecember 1, 2015 at 1:32 pm #545135Hi!
I am trying to solve the same problem and I have tried 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.
Is this filter compatible with WP 4.3.1/Enfold 3.4.3?If yes, what am I doing wrong?
If no, is there any other solutions that might work with WP 4.3.1/Enfold 3.4.3?Thanks,
Tim
December 1, 2015 at 2:14 pm #545159Hi!
@timhollander Can you please start a new thread and post FTP and WP admin credentials privately. If you post them here, OP would be able to see them.Cheers!
Yigit -
AuthorPosts
- You must be logged in to reply to this topic.