Tagged: , ,

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #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!

    #250013

    Hi 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,
    Yigit

    #250369

    Yigit,

    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!

    #250380

    I 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

    #250952

    Hi!

    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,
    Peter

    #545135

    Hi!
    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

    #545159

    Hi!


    @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

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.