Cambiar la oración en inglés de las páginas protegidas con contraseña> CreaZo
Rate this post
Cuando pones ciertas páginas de tu sitio en una página protegida con contraseña, tienes derecho a una frase encantadora en inglés que te lo especifica al acceder a esta: “Esta publicación está protegida con contraseña. Para verlo, ingrese su contraseña a continuación: «
Para eliminar esto y personalizarlo, puede agregar el siguiente código en su archivo functions.php:
function my_password_form() {
global $post;
$label = 'pwbox-'.(empty($post->ID) ? rand() : $post->ID);
$output = '
<div class="password-form">
' . __('Cette page est protégée par mot de passe, merci de le saisir.') . '
<form action="' . get_option('siteurl') . '/wp-pass.php" method="post">
<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></div>
';
return $output;
}
add_filter('the_password_form','my_password_form');
Y aquí está el resultado después de agregar este:
ATENCIÓN !
Si después de esta manipulación, se encuentra con una página 404 después de ingresar su contraseña, debe tener un problema con su tema. De hecho, desde la versión 3.4 de WordPress, la protección por contraseña ha cambiado, en lugar de usar el archivo wp-pass.php, ahora usa la construcción en la página wp-login.php con un atributo de acción. El archivo wp-pass.php se ha eliminado y ya no se enviará con WordPress.
Por lo tanto, para hacer esto, debe colocar el siguiente código en lugar del anterior:
function my_password_form() {
global $post;
$label = 'pwbox-'.(empty($post->ID) ? rand() : $post->ID);
$output = '
<div class="password-form">
' . __('Cette page est protégée par mot de passe, merci de le saisir.') . '
<form action="' . get_option('siteurl') . '/wp-login.php?action=postpass" method="post">
<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></div>
';
return $output;
}
add_filter('the_password_form','my_password_form');
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.