內容簡介
顯示你的讀者最近的評論列表(通常在側邊欄中)。 預設情況下,顯示最近五個已評論文章的最新評論。
您可以控制:
要顯示多少最近的評論
要顯示文章標題的多少個字符
如何在列表中樣式化每個評論(使用開/關標籤)
是否包括或省略引用的迴響
是否包括或省略文章作者的評論
希望永遠不顯示評論的使用者列表(例如您自己;或使用此選項創建黑名單)。
輕鬆設置說明請參閱「安裝」。
歷史
幾個月前,我想在我的博客的側邊欄中顯示最近評論的列表。 在搜尋無數返回評論列表的插件後,我最終決定使用Scott Reilly的Top/Recent Commenters插件。
不幸的是,我必須調整Scott的代碼才能按照我的意願工作。一個調整引導到另一個(您知道它是如何運作的),直到我最終放棄了原始代碼並自己推出了插件。(您可以在我的博客的主頁看到它在運行。)。
功能
添加單個模板函數:
rr_recent_comments (
$num_recent_posts = 5,
$before = '<li>',
$after = '</li>'
)
函數 rr_recent_comments()返回最新評論的列表。
當無參數調用時,它返回包含最近5篇文章的最新評論的列表。 列出每篇文章僅有一個評論(最新的評論)。
默認情況下,不會包括任何由文章作者進行的評論。(此行為可以根據設定進行修改)。 過長的文章標題會根據您的設定進行截斷。默認情況下,不包括迴響和引用的迴響在列表中。
基於各種標準(作者電子郵件,作者姓名等),您可以排除特定的貼文者。 例如,排除自己的查看十分有用。
您可以通過標籤參數和全局配置選項對列表進行自定義設置。
參數
函數 rr_recent_comments()具有三個參數,所有這些參數都是可選的。
$num_recent_posts
要顯示的评论數[最大]。
默認值:5
$before
每個評論前顯示的文本。
默認值: ‘<li>’
$after
每個評論後顯示的文本。
默認值:‘</li>’
配置選項
可以通過編輯插件文件rr_recent_comments.php中的一些值來全局自定義 rr_recent_comments()的行為。
除了$max_title_length之外,大多數安裝可能都不需要調整這些值,但如果您需要,可以使用它們。
$max_title_length(默認值:38)
此值表示未經截斷即可顯示的文章標題的最大長度。 長度超過此值的標題將被不加區分地截斷。
外掛標籤
開發者團隊
② 後台搜尋「Recent Love – A List of Recent Comments」→ 直接安裝(推薦)
原文外掛簡介
Displays a list (typically, in your sidebar) of your visitors’ recent comments.
By default, shows the latest comment from each of the last five commented-on posts.
You control:
how many recent comments to display
how many characters of the post title to display
how to style each comment in the list (with open/close tags)
whether to include or omit trackbacks/pingbacks
whether to include or omit comments from the post’s author
a list of users for whom never to display comments (e.g., yourself; or use this to create a blacklist).
See “Installation” for easy setup instructions.
History
A few months ago, I wanted to display a list of recent comments in my blog’s
sidebar. After searching through the countless plugins which return lists of
comments, I finally decided on Scott Reilly’s Top/Recent
Commenters plug-in.
Unfortunately, I had to tweak Scott’s code to get it to work the way I wanted.
One tweak led to another (you know how it is) until I finally just scrapped
the original code and rolled my own. (You can see it in action on my blog’s
front page.)
What It Does
Adds a single template function:
rr_recent_comments (
$num_recent_posts = 5,
$before = '
$after = '
'
)
The function rr_recent_comments() returns a list of recent comments.
When invoked with no parameters, it returns a list containing the latest comment from
each of the most recent 5 posts. Only one comment (the most recent one) per
post is listed.
By default, any comments made by the author of the post are not
included in the list. (This behaviour can be configurably modified.) Long
post titles are truncated to a length which you can configure. Trackbacks and
pingbacks are not included in the list by default.
You can exlcude certain posters, based on various criteria (author email,
author name, etc.). This is helpful, for example, to exclude yourself from
the list.
You can customize your list two ways: tag parameters and global config
options.
Parameters
The function rr_recent_comments() takes three parameters, all of which are optional.
$num_recent_posts
The [maximum] number of comments to display.
Default: 5
$before
The text to display before each comment.
Default: ‘
$after
The text to display after each comment.
Default: ‘
’
Configuration Options
The behaviour of rr_recent_comments() can be customized on a
global basis by editing some values in the plugin file, rr_recent_comments.php.
With the possible exception of $max_title_length,
most installations will probably not need to
futz with these, but they’re there if you want ’em.
$max_title_length (Default: 38)
This value represents the longest length that a post title
may be without it being truncated for display. Titles longer than this will
be indiscriminately chopped, and an ellipses will be appended to them. Set to
0 to disable truncation altogether (not recommended).
$exclude_authors_comments (Default: true)
Set to true to exclude an author’s comments from his/her
own posts. Set to false to include them.
$link_to_commenters_websites (Default: true)
Set to true to hyperlink the comment author’s name to the
website they enter on your comment form. Set to false to suppress
hyperlinking.
$suppress_trackbacks (Default: true)
If true, trackbacks and pingbacks are excluded from the
comment list. Set to false to include them.
$identify_authors_by and $excludes_sql_list
(Default: no exclusions)
These two fields work in conjunction to allow you to
specify a list of comments whose comments should never be included in
the list. (Note that most blog installation will not need to use this
functionality.)
First, choose the criterion by which you want to identify the
excluded comments and set $identify_authors_by to one of:
'comment_author',
'comment_author_url' or
'comment_author_email'.
Then add the excluded commenters to the list $excludes_sql_list;
be careful to follow the correct format, which is: ('COMMENTER_1', 'COMMENTER_2', ..., 'COMMENTER_N').
You must specify the COMMENTERs in a way that matches the value of $identify_authors_by. I.e., if $identify_authors_by
is 'comment_author_email', then the COMMENTERs in $excludes_sql_list must all be email addresses.
Revision History
0.1 (May 1, 2005): Initial revision.
0.2 (October 30, 2005): Rewrite and add new features.
0.3 (November 11, 2005): Clean up for publication.
0.4 (?)
0.5 (April 4, 2007): Add $link_to_commenters_websites option.
