开发者 |
andykeith
barn2media amirition kestrelwp |
---|---|
更新时间 | 2024年6月9日 23:49 |
捐献地址: | 去捐款 |
PHP版本: | 7.4 及以上 |
WordPress版本: | 6.4 |
版权: | GPL-3.0 |
版权网址: | 版权信息 |
[better_recent_comments]
.
That's not all! The plugin is also WPML compatible, which means that the comments will be restricted to those in the current language. The default WordPress widget will list all recent comments, regardless of language, so you might end up with comments for German-language posts in the sidebar of your English site. Better Recent Comments solves this and makes sure the comments are for the current language only.
Translations currently provided in Spanish, French and Italian.
View the full plugin documentation in our Knowledge Base.
Options available with the shortcode:
format
- the format of each recent comment. This option uses 'placeholders' which are substituted with the actual data when the comments are displayed. See the FAQs for details.number
- the number of comments to display. Default: 5 commentsdate_format
- the date and time format to use. Like WordPress, this uses a PHP date format. It defaults to 'M j, H:i'. See this cheat sheet for a full list of date and time options.avatar_size
- the size of the avatar in pixels. Only used if you have included {avatar} in your comment format (see 'format' option). Default: 50post_status
- the status of posts to retrieve comments for. Defaults to 'publish'. Can be a single status or a comma-separated list, or 'any' to show comments for all post statuses.post_type
- the post type to retrieve comments for. Accepts a single or multiple post types (e.g. 'post' or 'post, dlp_document') or 'any' to show comments for all post types. Default: 'any'excerpts
- set to 'true' to show an excerpt of the comment (limited to 20 words), or 'false' to show the full comment. Default: truereplies
- set to 'true' to also show responses to comments, or 'false' to only see the top level comments. Default: true/wp-content/plugins/better-recent-comments
directory, or install the plugin through the WordPress plugins screen directly.[better_recent_comments]
where you want the comments to be displayed.To add the widget, go to Appearance -> Widgets, and find the 'Better Recent Comments' widget in the list, then drag to any widget area. You can then set the title for the widget, the number of comments to show, and choose to show or hide the comment avatars, dates, comment text and post link.
If you would prefer to use the shortcode to set more specific options, add a Text widget to yout sidebar instead, and then add the [better_recent_comments]
shortcode to your widget.
Add [better_recent_comments]
to any post or page.
See the main plugin description for the list of shortcode options.
format
shortcode option?The format
option allows you to choose the exact format you want for your recent comments. This option uses placeholders which are substituted with the actual data when the comments are displayed.
The available placeholders are: {avatar}
, {author}
, {post}
, {comment}
and {date}
.
{avatar}
is the comment author's Gravatar image.{author}
is the comment author's name.{post}
is the title of the post, and contains a link to the author's comment below the post.{comment}
is the actual comment text.{date}
is the comment date (see the date_format
option in the main description to set the date format){author} on {post}: "{comment}" {date}
There is no built-in option for this, but you can set the length of the comments by adding the following code to your site.
In the code below change '10' to the number of words you would like. If you are using the [better_recent_comments]
shortcode, make sure to add the excerpts="true"
option.
add_filter( 'comment_excerpt_length', function( $number_of_words ) { return 10; } );
Yes, please visit http://barn2.com/better-recent-comments-demo/ to see Better Recent Comments in action.
The plugin has been designed to work with different themes and will take the styling from your theme for the fonts etc. where possible.
Use the shortcode as follows:
[better_recent_comments post_type="attachment" post_status="any"]
If you have a multilingual site using WPML then the plugin will display comments for the correct language automatically.
Unfortunately not. We've developed this free plugin to be flexible and easy to configure so that it will be suitable for as many different websites as possible.
Please visit our Knowledge Base.
replies
parameter in the shortcode