Go to main content




<txp:comments />

The comments tag can be used as a single tag or a container tag and is used to display the comments associated with a particular article. Comments will be displayed for the present individual article as a default, or to the article set by the id attribute.


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

form="form name"
Use specified form template to process each comment.
Default: comments.
The number of comments to display.
Default: 0 (no limit).
The 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: li or div, depends upon Preferences panel setting for ‘Present comments as a numbered list?’.
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: comments (see class cross-reference).
HTML element to wrap (markup) list block, specified without brackets (e.g. wraptag="ul").
Default: ol or unset, depends upon Preferences panel setting for ‘Present comments as a numbered list?’.


Example 1: Display comments and give an indication of comments status

<txp:comments />
    <txp:comments_form />
<txp:else />
    <p>Comments are turned off for this article.</p>

Comments for articles can be turned on or off at the author’s discretion for any article that is published; by using the scheme above in an ‘article’ type form, you can still have the on/off control over comments while still giving users indication of comment status.

Other tags used: comments_form, else, if_comments_allowed.

Example 2: Conditional comments

    <txp:comments form="comments" break="li" wraptag="ul" />
    <txp:comments_form />

And the comments form (which is a ‘comment’ type form):

<txp:comment_message />
<p class="footnote">
    <a href="mailto:<txp:comment_email />">Email</a> |
        <txp:comment_id />

For the article, list id numbers and a comment input form; but only if comments are currently allowed.

Other tags used: comment_email, comments_form, comment_id, comment_permlink, if_comments_allowed.


Version 4.7.0

breakby attribute added.

Version 4.6.0

Can be used as a container tag.
breakclass attribute deprecated.

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. :)