Go to main content

Recent comments



<txp:recent_comments />

The recent_comments tag is a single or a container tag. Textpattern will replace this tag with a list of permanent links to recent comments. This list will be displayed with the format:

bc. User’s Name (Article Name)

If used as a container, the tag must be specified as an opening and closing pair, like this:

    …contained statements…


Tag will accept the following attributes (case-sensitive) as well as the global attributes :

form="form name"
Use specified form template.
Default: unset (if left empty, the commenter’s name and article title in which the comment was made will be permlinked).
Number of comments to display.
Default: 10.
offset="integer" v4.0.7+
Number of comments to skip.
Default: 0.
sort="sort value(s)"
How to sort the resulting comment list. Specify a value from the ones below, followed by a space and then add either asc or desc to sort in ascending or descending order, respectively.
discussid (comment ID#).
ip (IP address).
parentid (article ID#).
rand() (random).
Default: posted asc.

Common presentational attributes

These attributes, which affect presentation, are shared by many tags. Note that default values can vary among tags.

Where value is an HTML element, specified without brackets (e.g. break="li") or some string to separate list items.
Default: br (but see break cross-reference for exceptions).
breakby="integer" v4.7.0+
Used to group list items when separating by break. Possible values are lists of integers, like 2 (groups of 2 items) or 1,2 (alternate groups of 1 and 2 items).
Default: 1 (actually unset).
class="class name"
HTML class to apply to the wraptag attribute value.
Default: tag name or unset (see class cross-reference).
Label prepended to item.
Default: unset (but see label cross-reference for exceptions).
HTML element to wrap (markup) label, specified without brackets (e.g. labeltag="h3").
Default: unset.
HTML element to wrap (markup) list block, specified without brackets (e.g. wraptag="ul").
Default: unset (but see wraptag cross-reference for exceptions).


Example 1: Labelled list of recent comments

<txp:recent_comments label="Recent Comments" wraptag="p" break="br" />

Example 2: Recent comments as an ordered list

<txp:recent_comments label="Recent Comments" wraptag="ol" break="li" limit="25" />

This example also increases the results to a maximum of 25 list items (instead of the default 10).


Version 4.7.0

breakby attribute added.

Version 4.0.7

Can be used as a container tag.
offset attribute added.

If you notice any kind of problem with this page's construction or content (outdated information, typos, broken links, or whatever), open an issue to have it sorted. Or have a go at it yourself. :)