[WordPress] 外掛分享: Top Authors

首頁外掛目錄 › Top Authors
WordPress 外掛 Top Authors 的封面圖片
100+
安裝啟用
★★★★
4.7/5 分(6 則評價)
3935 天前
最後更新
問題解決
WordPress 3.5.0+ v1.0.11 上架:2010-10-25

內容簡介

「Top authors」可讓您列出您的頂級作者,提供豐富的選項。您可以在每個小工具中設定以下選項:

小工具標題
要排除的角色
要包括的文章類型
要顯示的作者
4 個預設顯示模板
自定顯示模板,可讓您創建完全自定的結構並在列表之前和之後修改輸出。
存檔(分類/標籤/分類法)專用作者列表

有關如何設置自定作者列表的更詳細說明,請參閱其他注意事項一節。此外,該外掛還具有一些開發人員友好的功能,請參閱其他注意事項一節以獲取更多信息。

鳴謝

Seb Van Dijk 免費捐贈此外掛給我使用,我欠你一個人情 🙂
Font Awesome 提供了外掛圖標

使用方法

外掛的大多數選項都是自解釋的,我想強調一下存檔專用作者和顯示模板。

如果勾選了「存檔專用作者」,該外掛將在分類、標籤和分類法存檔頁面上以不同的方式處理作者。它將僅縮小為給定存檔中的文章。實際上,這意味著以下內容:

例如,約翰在網站上寫了 10 篇文章,吉爾寫了 5 篇。在常規頁面上,約翰將排在第一位,吉爾將排在第二位。但是,約翰在「食品」分類中寫了 3 篇文章,而吉爾寫了 4 篇。在「食品」分類的存檔頁面上(如果勾選了存檔專用作者),將首先顯示吉爾,並顯示 4 篇文章,然後顯示約翰和 3 篇文章。

當您選擇「自定結構」作為預設顯示時,您應該看到三個新字段:顯示模板、列表之前和列表之後。這些字段可用於控制作者的 HTML 顯示。為了確保您可以使用小工具檢索到的數據,我已經添加了佔位符,這些佔位符將更換為實際數據:

%posts_url%:用戶的文章存檔頁面的 URL
%website_url%:用戶的網站 URL
%gravatar_SIZE%:給定大小的用戶 gravatar。例如,要顯示 50px Gravatar,您將使用 %gravatar_50%
%firstname%:用戶的名字
%lastname%:用戶的姓氏
%displayname%:用戶的顯示名稱
%username%:用戶的用戶名
%post_count%:文章數量
%meta_FIELD%:顯示給定的元數據字段。如果您在「Twitter」元數據字段中儲存用戶的 Twitter 名稱,則可以使用 %meta_twitter% 顯示它。

自 1.0.9 版起,還增加了自定 ID 字段。這是高級用法,主要針對開發人員。它允許在小工具之間進行自定 CSS 樣式和甚至自定查詢。

開發人員

目前有三個篩選器可用於控制小工具中可用的選項。

ta/usable_roles 允許您更改可選擇的角色。它應該以 slug=>name 的形式返回一個角色數組
ta/usable_opst_types 允許您更改可選擇的文章類型。它應該返回一個文章類型對象數組
ta/post_query 允許您修改 WP_Query 的參數,該參數檢索我們查找作者的文章。如果您希望強制要求在單個文章頁面上進行特定分類的頂級作者,或進行其他類似的用法,則修改參數。

外掛標籤

開發者團隊

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

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

原文外掛簡介

Top authors allows yoy to list your top authors with plenty of options. You can set the following in each widget:

Widget title
Roles to exclude
Post types to include
Authors to show
4 Preset display templates
Custom display template that allows you to create a completely custom structure and modify the output before and after the list.
Archive (category/tag/taxonomy) specific author lists

For a more detailed description of how you can set up custom author lists take a look at the other notes section. The plugin also has some developer friendly features, take a look at the other notes section for more.
Thanks

Seb Van Dijk for donating this plugin to me for free, I owe you one 🙂
Font Awesome for the plugin icon

Usage
Most of the options for the plugin are self explanatory, I thought I’d highlight the archive specific authors and the display template.
If Archive specific authors is checked the plugin will handle authors differently on category, tag and taxonomy archive pages. It will narrow the posts down to only those in the given archive. Practically this means the following:
Say John wrote 10 posts on the website and Jill wrote 5. On normal pages John would be listed first, Jull would be listed second. However, John wrote 3 posts in the “Food” category while Jill wrote 4. On the archive page for the “Food” category – if Archive specific authors is checked – Jill will be shown first with 4 posts and John second with 3.
When you select “Custom Structure” as the preset display you should see three new fields: Display Template, Before List and After List. These fields can be used to control the HTML display of your authors. To make sure you can use the data retireved by the widget I’ve added placeholders which will be replaced by real data:

%posts_url%: The URL to the user’s post archive page
%website_url%: The URL to the user’s website
%gravatar_SIZE%: The gravatar of the user at the given size. For example, to display a 50px Gravatar your would use %gravatar_50%
%firstname%: The user’s first name
%lastname%: The user’s last name
%displayname%: The user’s display name
%username%: The user’s username
%post_count%: Number of posts
%meta_FIELD%: Displays the given meta field. If you store a user’s Twitter name in the ‘twitter’ meta field you could use %meta_twitter% to display it.

As of 1.0.9 there is also a custom ID field. This is for advanced use, mainly for developers. It allows for custom CSS stylings and even custom queries on a widget-to-widget basis.
For Developers
Currently there are three filters you can use to control the options available in the widget.

ta/usable_roles allows you to change the roles that can be selected. It should return an array of roles in the form of slug=>name
ta/usable_opst_types allows you to change the post_types that can be selected. It should return an array of post type objects
ta/post_query allows you to modify the arguments of the WP_Query which retrieves the posts that we look up the authors for. Modify the arguments if you want to force category-specific top authors on single post pages, or other similar uses

延伸相關外掛

文章
Filter
Apply Filters
Mastodon