[WordPress] 外掛分享: Comment Form Inline Errors

首頁外掛目錄 › Comment Form Inline Errors
WordPress 外掛 Comment Form Inline Errors 的封面圖片
20+
安裝啟用
★★★★★
5/5 分(2 則評價)
4508 天前
最後更新
問題解決
WordPress 3.0+ v1.0.2 上架:2013-09-10

內容簡介

這款外掛專門處理 WordPress 內部評論錯誤處理,並將評論錯誤顯示在表單上方,而不是使用只有單行錯誤描述的奇怪灰色頁面。這一切都是開箱即用的。

它還記住您輸入的內容。例如,如果您填寫評論表單,發送並忘記必填項目,外掛會在表單上方顯示錯誤,並在提交的值中預填表單,因此您不必重新輸入(這很麻煩)。

默認情況下,外掛會在以下標記中打印錯誤:

--error-here--

因此,您很容易使用“ .formError”或“ #formError”在 CSS 文件中樣式化它。默認的紅色是為了防止您無法樣式化,並且由於它是錯誤,紅色似乎是合適的。

順便說一下,如果您使用新字段自定義了評論表單,並且正在使用“ preprocess_comment”鉤子以正確的 WordPress 方式處理錯誤,即在遇到錯誤時使用“ wp_die”,此外掛將與之兼容,並顯示您的錯誤消息在表單上方。

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.0.2) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Comment Form Inline Errors」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

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. 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 :). 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, 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.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon