前言介紹
- 這款 WordPress 外掛「Favorites」是 2015-03-04 上架。
- 目前有 10000 個安裝啟用數。
- 上一次更新是 2025-04-10,距離現在已有 24 天。
- 外掛最低要求 WordPress 3.8 以上版本才可以安裝。
- 外掛要求網站主機運作至少需要 PHP 版本 5.4 以上。
- 有 131 人給過評分。
- 論壇上目前有 11 個提問,問題解答率 9%
外掛協作開發者
外掛標籤
like | likes | Bookmark | favorite | favorites |
內容簡介
取得函式: get_favorites_button($post_id, $site_id)
列印函式: the_favorites_button($post_id, $site_id)
短代碼: [favorite_button post_id="" site_id=""]
收藏計數(根據文章)
每篇文章的總收藏數都被保存為一個簡單的整數。如果用戶取消收藏文章,這個計數就會更新。預設情況下,匿名用戶的收藏計入總數,但可以通過外掛的設置來禁用。在所有情況下,如果在循環內部,則可以將文章 ID 留空。
取得函式: get_favorites_count($post_id)
列印函式: the_favorites_count($post_id)
顯示總收藏計數: [favorite_count post_id=""]
用戶收藏列表
要顯示已收藏文章的列表,使用以下功能。如果要顯示屬於不同網站的文章列表,可以通過選擇適當的站點 ID 來實現多站點兼容性。
顯示收藏列表: [favorite_list]
按照站點顯示: [favorite_list site_id=""]
按照文章顯示: [favorite_list post_ids=""]
收藏徽章(輸出按文章排序後的收藏計數)
以可配置的格式輸出收藏次數: [favorite_badge format="collapsed"]
按站點顯示: [favorite_badge site_id=""]
對於完整的可用函數列表和短代碼列表,請訪問 favoriteposts.com。
重要提示:Favorites 需要 WordPress 版本 3.8 或更高版本,以及 PHP 版本 5.4 或更高版本。
使用方法
收藏按鈕
通過在外掛設置中啟用特定的文章類型,可以自動在文章內容之前和/或之後添加收藏按鈕。也可以使用包含的功能或短代碼在模板文件中添加。如果在循環內部,文章 ID 可以留空。對於多站點安裝,網站 ID 參數為可選參數(默認為當前站點)。
原文外掛簡介
Why Favorites?
Favorites is designed for end users and theme developers. It provides an easy-to-use API for adding favorite button functionality to any post type.
The plugin can provide a way to save favorites, likes, bookmarks, or any other similar types of data with its customizable button text.
Visit favoriteposts.com for a full list of available template functions and shortcodes.
Features
Use with Any Post Type – Enable or disable favorite functionality per post type while automatically adding a favorite button before and/or after the content. Or, use the included functions to display the button anywhere in your template.
Available for All Users – Don’t want to hide functionality behind a login? Favorites includes an option to save anonymous users’ favorites by either Session or Cookie. Logged-In users’ favorites are also saved as user meta
Designed for Developers – Favorites works great out-of-the-box for beginners, but a full set of template functions unlocks just about any sort of custom functionality developers may need. Favorites outputs the minimum amount of markup needed, putting the style and control in your hands.
GDPR
As of version 2.2, a setting is provided to help comply with GDPR standards. To enable this setting, visit Settings > Favorites > Users, and check the field under “User Cookie Consent.” When this setting is enabled, the content saved under the setting displays in a modal window, and the user must agree to the terms you provide before favorite cookies can be saved. Note: There is no language provided by default. This should be supplied by a qualified attorney or legal entity. Once the user has approved or denied cookies, that is saved in the “simplefavorites” cookie along with the timestamp of approval or denial. If the site is part of a multi-site installation, the setting will carry through to all sites.
If your site already has a cookie compliance solution in place, there are two document-level jQuery events that may be triggered in order to approve or deny cookies in the background.
To approve the use of cookies, trigger the event “favorites-user-consent-approved”. To deny the use of cookies, trigger the event “favorites-user-consent-denied”.
Multisite Compatible – As of version 1.1.0, Favorites is multisite compatible. User favorites are saved on a site/blog basis, and may be retrieved and displayed across sites.
For more information visit favoriteposts.com.
Important: Favorites requires WordPress version 3.8 or higher, and PHP version 5.4 or higher.
Usage
Favorite Button
The favorite button can be added automatically to the content by enabling specific post types in the plugin settings. It may also be added to template files or through the content editor using the included functions or shortcodes. The post id may be left blank in all cases if inside the loop. The site id parameter is optional, for use in multisite installations (defaults to current site).
Get function: get_favorites_button($post_id, $site_id)
Print function: the_favorites_button($post_id, $site_id)
Shortcode: [favorite_button post_id="" site_id=""]
Favorite Count (by Post)
Total favorites for each post are saved as a simple integer. If a user unfavorites a post, this count is updated. Anonymous users’ favorites count towards the total by default, but may be disabled via the plugin settings. The post id may be left blank in all cases if inside the loop.
Get function: get_favorites_count($post_id)
Print function: the_favorites_count($post_id)
Shortcode: [favorite_count post_id=""]
Favorite Count (by User)
Displays the total number of favorites a user has favorited. Template functions accept the same filters parameter as the user favorites functions.
Get function: get_user_favorites_count($user_id, $site_id, $filters)
Print function: the_user_favorites_count($user_id, $site_id, $filters)
Shortcode: [user_favorites user_id="" site_id="" post_types=""]
User Favorites
User favorites are stored as an array of post ids. Logged-in users’ favorites are stored as a custom user meta field, while anonymous users’ favorites are stored in either the session or browser cookie (configurable in the plugin settings). If the user id parameter is omitted, the favorites default to the current user. The site id parameter is optional, for use in multisite installations (defaults to current site).
Get function (returns array of IDs): get_user_favorites($user_id, $site_id)
Get function (returns html list): get_user_favorites_list($user_id, $site_id, $include_links, $filters, $include_button, $include_thumbnails = false, $thumbnail_size = 'thumbnail', $include_excerpt = false)
Print function (prints an html list): the_user_favorites_list($user_id, $site_id, $include_links, $filters, $include_button, $include_thumbnails = false, $thumbnail_size = 'thumbnail', $include_excerpt = false)
Shortcode (prints an html list, with the option of omitting links): `[user_favorites user_id=”” include_links=”true” site_id=”” include_buttons=”false” post_types=”post” include_thumbnails=”false” thumbnail_size=”thumbnail” include_excerpt=”false”]
List Users Who Have Favorited a Post
Display a list of users who have favorited a specific post. If the user id parameter is omitted, the favorites default to the current user. The site id parameter is optional, for use in multisite installations (defaults to current site). The get function returns an array of user objects.
Get function (returns array of User Objects): get_users_who_favorited_post($post_id, $site_id)
Print function (prints an html list): the_users_who_favorited_post($post_id = null, $site_id = null, $separator = 'list', $include_anonymous = true, $anonymous_label = 'Anonymous Users', $anonymous_label_single = 'Anonymous User')
Shortcode (prints an html list): `[post_favorites post_id=”” site_id=”” separator=”list” include_anonymous=”true” anonymous_label=”Anonymous Users” anonymous_label_single=”Anonymous User”]
Clear Favorites Button
Displays a button that allows users to clear all of their favorites.
Get function: get_clear_favorites_button($site_id, $text)
Print function: the_clear_favorites_button($site_id, $text)
Shortcode: `[clear_favorites_button site_id=”” text=”Clear Favorites”]
Favorite Count (Across all Posts)
Displays the total number of favorites for a given site.
Get function: get_total_favorites_count($site_id)
Print function: the_total_favorites_count($site_id)
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Favorites」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
1.0 | 1.0.1 | 1.0.2 | 1.0.3 | 1.0.4 | 1.0.5 | 1.1.0 | 1.1.1 | 1.1.2 | 1.1.3 | 1.1.4 | 1.2.0 | 1.2.1 | 1.2.2 | 1.2.3 | 2.0.1 | 2.0.2 | 2.1.0 | 2.1.1 | 2.1.2 | 2.1.3 | 2.1.4 | 2.1.5 | 2.1.6 | 2.2.0 | 2.3.0 | 2.3.1 | 2.3.2 | 2.3.3 | 2.3.4 | 2.3.5 | 2.3.6 | trunk |
延伸相關外掛(你可能也想知道)
WP Favorite Posts 》允許使用者將文章加入至我的最愛。此外掛程式會使用 Cookies 與資料庫儲存資料。, , 若使用者已登入,則我的最愛資料會儲存在資料庫中而非 Cookies 中。, 若...。
CBX Bookmark & Favorite 》這個外掛的靈感來自 YouTube 的書籤或收藏夾功能。用戶可以創建其自己的公開或私人書籤分類,並在不同的文件夾、列表或分類中保存文章。稍後,我們擴展了外掛...。
wp_favorites 》WP Favorites 允許已登錄用戶收藏標籤並只查看包含該標籤的文章。用戶還可以收藏多個標籤,並只查看包含所有這些標籤(或選擇包含其中任何一個標籤)的文章。...。
Favorite Post 》這是一個簡單又好用的 WordPress 收藏文章外掛。, 功能, , 提供一個按鈕用來收藏文章。, 僅適用於登入使用者。, 有收藏文章的小工具。, 支援自定義文章類型。...。
GamiPress – Favorites integration 》透過強大的遊戲化外掛程式GamiPress,將您的Favorites交互設計變得更有趣!, 此外掛程式會自動將GamiPress與Favorites連接,新增新的活動事件。, 新的活動事...。
Random Featured Post 》隨機特色文章外掛可以讓您顯示某個指定類別的隨機文章。理想情況下,這可以引導首次造訪您網站首頁的讀者閱讀一些最佳文章。這個特色文章將會顯示標題「特色...。
DBWD Bookmark Page 》, 在不編輯主題的情況下,將一個「加入書籤」按鈕新增到您的標頭中 - 已經在 Firefox 和 IE 上進行測試。, 鼓勵您的訪客實際上將您的頁面加入書籤 - 增加回訪...。
Custom Admin-Bar Favorites 》允許管理員和其他使用者(具有特別定義的使用者權限)在管理工具列上定義自訂選單,以放置最愛連結。, 支援, 本外掛的技術支援將透過 WordPress 外掛論壇提供...。
WP Favorite Posts Extended 》這個外掛基於「WP Favorite Posts」,並擴展了 JSON API,提供給手機應用程式存取。, 這個外掛提供了三個方法:, wpfp/add, postid:必填, cookie...。
My Faves for WP 》儲存您重要的文章,讓您隨時可以回到它們並重新閱讀或觀看。, , , 請按下「Fave it」按鈕,以將文章添加至您的清單中,然後加入標籤並按下 enter 鍵, , , 若...。
Favorites Posts 》這個外掛提供一個小工具,允許在側邊欄中的特殊區塊中顯示所選文章的公告。支援顯示縮略圖、自訂欄位與自定樣式。樣式可以透過單獨的 CSS 檔案進行設定。, 小...。
BP Who Favorited 》BuddyPress 是一款建立社群網站的好用外掛。使用者可以透過新增各種更新、留言和回覆來參與社群,並可以將活動新增至收藏夾。如果您喜歡某項更新,可以將它加...。
BP Favorite Plus 》, 經測試適用於 BuddyPress 6.0, , 此外掛讓使用者能夠在每個活動之後顯示喜愛該活動的使用者頭像。您只需要安裝並設定即可使用!, 主要功能:, , 使用 Buddy...。
Bp Favorite Notifications 》當用戶將活動標記為收藏時,顯示BuddyPress用戶通知。
WP-Handbook 》您可以將文章添加到手冊(收藏列表)中,以便打印或創建 PDF 文件。。