我也面临同样的问题,正在寻找解决方案,我找到了解决方案
打开函数。php文件和过去的以下代码:
function comment_validation_init() {
if(is_single() && comments_open() ) { ?>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
$(\'#commentform\').validate({
rules: {
author: {
required: true,
minlength: 2
},
email: {
required: true,
email: true
},
comment: {
required: true,
minlength: 20
}
},
messages: {
author: "Please fill the required field",
email: "Please enter a valid email address.",
comment: "Please fill the required field"
},
errorElement: "div",
errorPlacement: function(error, element) {
element.after(error);
}
});
});
</script>
<?php
}
}
add_action(\'wp_footer\', \'comment_validation_init\');
对于给定样式:
.error { padding: 10px 0 20px 0; color: #FF0000; }
input.error, textarea.error { color:#000000; }