[wordpress插件] Comment Form Inline Errors评论表单内联错误

wordpress 插件 文章 2020-03-28 13:30 502 0 全屏看文

AI助手支持GPT4.0

评分
100
描述

This plugin takes care of WordPress inner comments error handling, and shows comment errors above the form, instead of using the weird grey page with single line error description.

此插件负责WordPress内部注释错误处理,并在表单上方显示注释错误,而不是使用带有单行错误描述的怪异灰色页面。

All this out-of-the-box.

所有这些开箱即用

It also remembers what you've typed in. So for example, if you fill in the comment form, and send it and forget required field, it will show the error above the form, and

它还会记住您输入的内容。例如,如果您填写评论表格,然后发送并忘记必填字段,它将在表格上方显示错误,并且

prefills the form with values you've submitted so you don't have to retype them again (which is annoying).

用您已经提交的值预填充表单,因此您不必再次键入它们(这很烦人)。

By default, the plugin prints the error in this markup:

默认情况下,插件会在此标记中显示错误:

    

  
    

--error-here--

-这里有错误-

So it should be quite easy for you to style it in your css file with ".formError" or "#formError", you know the drill :).

因此,使用“。formError” “#formError” 在css文件中设置样式应该非常容易,您知道该钻头:)。

The default red colour is there just in case you won’t be able to style and since it’s error, red seems appropriate.

红色是默认颜色,以防万一您无法设置样式,并且由于错误,红色似乎很合适。

By the way, if you've customised your comment form with new fields, and you're using the preprocess_comment hook, with the correct WordPress way of handeling errors

顺便说一句,,如果您已经使用新字段自定义了注释表单,并且正在使用 preprocess_comment 钩子以及正确的WordPress处理错误的方式

, which is using wp_die on error encounter, this plugin will play nicely with that, and display your error messsage above the form as well.

,它在遇到错误时使用 wp_die ,此插件可以很好地发挥作用,并在表格上方显示错误消息。

安装步骤

    1. Go to your admin area and select Plugins -> Add new from the menu.
    2. 转到您的管理区域,然后从菜单中选择插件->添加新内容。

    3. Search for “Comment Form Inline Errors”.
    4. 搜索“注释表单内联错误”。

    5. Click install.
    6. 单击安装。

    7. Click activate.
    8. 单击激活。

下载地址
https://downloads.wordpress.org/plugin/comment-form-inline-errors.1.0.2.zip
-EOF-

AI助手支持GPT4.0