Lists on tags: selection, archive, labels, categories and site counters
How to show latest posts and comments, a monthly archive, a label cloud, a category tree and site counters in any tag file, and how to select posts.
These tags work in any tag file: in the main frame, on a page, in a feed. The selection is written in the list name itself as «key:value» pairs separated by colons; several values are joined with «_». Protection keys, email and private data never reach the lists; posts are chosen by the same query as the feed (rights, password, language, validity period).
Kinds of lists
| List | What it gives |
|---|---|
[each:news_list category=films,3 limit=5 sort=views] … [/each] | posts; the short form [each:news_list:cat:3_5:limit:5:sort:views] gives the same result |
[each:comments_list limit=5 category=3] | latest comments on posts; for a signed-in visitor {item.name} is their own name |
[each:news_archive:limit:12] | archive months |
[each:news_tags:limit:30] | label cloud |
[each:news_categories] | categories as a tree: parent first, then children |
How to select posts
| Key | What it does |
|---|---|
category | categories by number or address: 3, films, 3,5, 3-7, !news (except; children are included) |
not_category | all except these categories |
author | numbers or logins, comma separated |
tag | labels by number or address |
id, not_id | only these posts / all except these; not_id=this — except the current one |
days | for how many days back |
sort | new, old, title, views, rating, rand, updated |
start, limit | which post to start from and how many (up to 30) |
home, fixed, cover, poll, password | 1, yes — only such posts; 0, no — only those without |
field:name>2000 | by your own field: =value, !=value, >, <; numbers are compared as numbers; up to four conditions |
custom + is | the field is filled / equals a value |
cache | remember the result for guests for this many seconds (up to 3600); a signed-in visitor always gets fresh data |
lang | language of the posts |
An unknown name is ignored, and the theme editor highlights it. comments_list has a shorter selection: limit, category, not_category, author, days, post (post numbers). news_archive and news_tags take limit.
news_categories takes category (which categories), not_category (except), subcat — yes with children, no only the named ones, only only the children; depth — how many levels; limit.
What is available inside a list
| List | Item tags |
|---|---|
| posts | {item.id} {item.title} {item.url} {item.excerpt} {item.date} {item.cover} {item.cover_large} {item.category} {item.category_url} {item.by} (author, if the site shows authors) {item.views} {item.rating} {item.rating_count} {item.comments} {item.pinned} {item.locked} (post under a password: only the title is visible) {item.first} {index} |
| comments | {item.name} {item.text} (up to 160 characters, no markup) {item.url} {item.date} {item.title} (post title) {item.avatar} |
| archive | {item.title} {item.url} {item.count} |
| labels | {item.title} {item.url} {item.count} {item.weight} (1–5, for the font size) |
| categories | {item.title} {item.url} {item.count} {item.active} (current category) {item.level} (0 — top level) {item.parent} {item.id} and the condition [if:item.has_children] |
Pictures from the post text by number: {item.image1}…{item.image5} and {item.images_count}; the text is parsed only if the template asks for them.
Site counters
{stat.news} {stat.news_day} {stat.news_week} {stat.news_month}; the same for comments and users, for example {stat.comments_week} and {stat.users_month}.
Example: categories with post counts and popular this month
<nav><ul>
[each:news_categories]<li class="l{item.level}"><a href="{item.url}">{item.title}</a> <small>{item.count}</small></li>[/each]
</ul></nav>
<h3>Popular</h3>
[each:news_list:days:30:sort:views:limit:5]<p><a href="{item.url}">{item.title}</a> · {item.views}</p>[/each]
<p>Posts: {stat.news}, this week: {stat.news_week}</p>