您好:我添加了一个函数,当为受密码保护的页面输入了错误的密码时,该函数会生成错误消息。我试图将消息的颜色更改为红色,但没有运气。这是功能:
function wpse_71284_custom_post_password_msg( $form )
{
// No cookie, the user has not sent anything until now.
if ( ! isset ( $_COOKIE[ 'wp-postpass_' . COOKIEHASH ] ) )
return $form;
// Translate and escape.
$msg = esc_html__( 'Sorry but you have entered the incorrect password is wrong. Please try again.', 'your_text_domain' );
// We have a cookie, but it doesn’t match the password.
$msg = "<p class='custom-password-message'>$msg</p>";
return $msg . $form;
}
尝试更改以&#34开头的文字颜色;抱歉,但是......&#34;我尝试添加样式但显然语法不正确。任何帮助表示赞赏。感谢。
答案 0 :(得分:1)
更改
$msg = "<p class='custom-password-message'>$msg</p>";
到
$msg = "<p class='custom-password-message' style='color:red'>$msg</p>";
或更好:
$msg = "<p class='custom-password-message error'>$msg</p>";
然后添加到你的style.css:
.error { color: red; }