內容簡介
查看已登入使用者認為哪些文章很有幫助。
你是否曾想知道自己文章的品質?至少是一點點嗎?
這就是 That Was Helpful 應用程式的功用。
這款簡單的外掛可以讓你追蹤有多少已登入使用者認為各個文章很有幫助。
用法
這款外掛的目的在於提供一種方法來標示各個文章是否有幫助。每個唯一的使用者只能對每篇文章投票一次,當然,已投票的選票可以撤回。
動作
如果你想根據某些(複雜的)條件(而不是總是)來顯示表單,只需將 do_action('that_was_helpful', $optional_post_id) 包裝在條件中,然後將其放在所需的範本檔案中。如果提供現有的文章 ID 作為參數,則會顯示相應文章的選票。否則,將使用當前文章。
篩選器
為了自定義外掛的某些方面,它為你提供了幾個篩選器。對於每一個,下面都提供了簡短的描述以及如何改變默認行為的程式碼示例。只需將相應的代碼片段放在你的主題的 functions.php 檔案或自定義外掛中,或放在其他適當的地方。
that_was_helpful_capability
管理外掛的設置受到限制,必須擁有某種特定的權限,默認情況下是 manage_options。
/** * 篩選管理設置所需的權限。 * * @param string $capability 管理設置所需的權限。 */ add_filter( 'that_was_helpful_capability', function() { return 'edit_users'; } );
貢獻
要為這個外掛做出貢獻,請參閱其 GitHub 存儲庫。
如果你有功能請求,或者你已經開發了該功能,請隨便使用問題和/或拉取請求部分。
當然,如果你想要把這個外掛翻譯成其他未包括的語言,也歡迎提供翻譯。
外掛標籤
開發者團隊
📦 歷史版本下載
原文外掛簡介
Find out what posts logged-in users found helpful.
Have you ever wanted to know about the quality of your posts? At least a little bit?
This is exactly when That Was Helpful kicks in.
This simple plugin lets you track how many logged-in users found individual posts helpful.
Usage
What this plugin is all about is providing a means to mark individual posts helpful. Each unique user can vote only once for each post. Of course, cast votes can be retracted.
Actions
In case you want to show the form depending on some (complicated) condition (and not always), simply wrap do_action( 'that_was_helpful', $optional_post_id ) in the condition, and put it in your desired template file(s). If you provide an existing post ID as parameter, the according post’s votes are displayed. Otherwise the current post is used.
Filters
In order to customize certain aspects of the plugin, it provides you with several filters. For each of these, a short description as well as a code example on how to alter the default behavior is given below. Just put the according code snippet in your theme’s functions.php file or your customization plugin, or to some other appropriate place.
that_was_helpful_capability
Managing the plugin’s settings is restricted to a certain capability, which is by default manage_options.
/** * Filters the capability required to manage the settings. * * @param string $capability Capability required to manage the settings. */ add_filter( 'that_was_helpful_capability', function() { return 'edit_users'; } );
Contribution
To contribute to this plugin, please see its GitHub repository.
If you have a feature request, or if you have developed the feature already, please feel free to use the Issues and/or Pull Requests section.
Of course, you can also provide me with translations if you would like to use the plugin in another not yet included language.
