Skip to content

Instantly share code, notes, and snippets.

@Pavracer
Created May 16, 2020 05:28
Show Gist options
  • Save Pavracer/80b6836365673170bffc28a46956411c to your computer and use it in GitHub Desktop.
Save Pavracer/80b6836365673170bffc28a46956411c to your computer and use it in GitHub Desktop.
remove_parent_filters_password
function myremove_parent_filters(){
remove_filter('the_password_form', 'et_password_form');
}
add_action( 'after_setup_theme', 'myremove_parent_filters' );
function myet_password_form() {
$pwbox_id = rand();
$form_output = sprintf(
'<div class="et_password_protected_form">
<h1>%1$s</h1>
<p>%2$s:</p>
<form action="%3$s" method="post">
<p><label for="%4$s">%5$s: </label><input name="post_password" id="%4$s" type="password" size="20" maxlength="20" /></p>
<p><button type="submit" name="et_divi_submit_button" class="et_submit_button et_pb_button">%6$s</button></p>
</form>
</div>',
esc_html__( 'Password Protected', 'Divi' ),
esc_html__( 'To view this protected post, enter the password below', 'Divi' ),
esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ),
esc_attr( 'pwbox-' . $pwbox_id ),
esc_html__( 'Password', 'Divi' ),
esc_html__( 'Submit', 'Divi' )
);
$output = sprintf(
'<div class="et_pb_section et_section_regular">
<div class="et_pb_row">
<div class="et_pb_column et_pb_column_4_4">
%1$s
</div>
</div>
</div>',
$form_output
);
return $output;
}
add_filter( 'the_password_form', 'myet_password_form' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment