lucydm
March 9, 2018, 11:39pm
1
Hello
Can I please have the correct css to change the text that shows on a password protected post.
It currently says:
“This post is password protected. To view it please enter your password below:”
I would like to change it to:
“This material is password protected. To view it please enter your password below:”
Thank you,
Lucy
Hi there
Hope you are having a good day and thank you for your question
Lucy this is WordPress territory and my suggestion is to search for an answer in WordPress related forums or in the internet
Thanks!
Colorlib Support Team
lucydm
March 12, 2018, 12:19pm
3
I have done this and the code supplied will not work in my custom css area.
Can you tell me why this one won’t work:
<?php
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”>
’ . __( “This material is password protected. To view it please enter your password below:” ) . ’
<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;
}
?>
lucydm
March 12, 2018, 12:22pm
4
I also tried this and it won’t work:
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”>’ . __( " This material is password protected. To view it please enter your password below:" ) . ’
<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’ );
lucydm
March 12, 2018, 12:27pm
5
This is the code supplied on wordpress.org but it also shows with errors in custom css. Please can you help me make it suitable for Activello?
<?php
function my_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’ ) ) . ‘" method=“post”>
’ . __( “This material is password protected. To view it please enter your password below:” ) . ’
<label for="’ . $label . ‘">’ . ( “Password:” ) . ’ </label><input name=“post_password” id="’ . $label . ‘" type=“password” size=“20” maxlength=“20” /><input type=“submit” name=“Submit” value="’ . esc_attr ( “Submit” ) . '" />
</form>
';
return $o;
}
add_filter( ‘the_password_form’, ‘my_password_form’ );
?>
Hi there
First of all, these codes are not for custom CSS, copy/paste them into the function.php (Make sure you are using child theme)
Secondly, when you get the third-party code from outside of this support you have to ask the guidance of implementation to the code author
lucydm
March 12, 2018, 1:52pm
7
When I first started using Activello, this kind of help was given on this forum.
I have found a few different types of css for this and tried them but no no avail. Could you look at these and perhaps suggest something?
.post-password-form p:first-child {
visibility: hidden;
}
.post-password-form p:first-child:before {
content: “This material is password protected.”;
visibility: visible;
}
Or this:
.post-password-required {
content: “This material is password protected.”
}
There must be a simple soultion?
Hi @Lucydm
Yes, i understand you, we can help you in many things but not in everything, especially when this is related to the WordPress or third-party code providers, you can check our support policy
I think I have one idea, but I cant guarantee if it will work, please provide one of the password protected pages, let me see it
lucydm
March 13, 2018, 9:29am
9
Thank you.
www.theloveplace.co.uk/discover
I really appreciate it!
hey there
Please add this CSS in appearance - customize - additional CSS
form.protected-post-form p:first-child:before {
content: "This material is password protected.";
visibility: visible;
}
form.protected-post-form p:first-child {
visibility: hidden;
}
Thanks!
Colorlib Support Team
Hi, there
Nice to hear your problem is fixed:)
Now I will now close the topic and mark it as resolved.
Feel free to contact us again Thanks!