The article_custom tag is a single or a container tag that provides a variety of custom options for sorting, selecting, and displaying articles (the tag will be replaced with one or more articles).
If used as a container, it must be specified as an opening and closing pair of tags, like this:
<txp:article_custom> ...contained statements... </txp:article_custom>
This is equivalent to putting the contained statements into a form named “my_form” and using:
<txp:article_custom form="my_form" />.
Unlike the article tag, article_custom will always return an article list and is not context-sensitive. This means while the article tag can only see posts within the currently viewed section/category/author and so forth, article_custom can see all posts from all sections, categories and authors unless you restrict it via attributes (see below), thus context-sensitive navigation tags, such as older and newer, will not work.
Related: if_article_list, if_first_article, if_last_article, if_individual_article
section="retrieves all sections"
category="retrieves all categories"
month="unset" (yyyy, yyyy-mm, yyyy-mm-dd)
author="retrieves all authors"
List articles published in specified month
<txp:article_custom form="month_list" sort="Section asc" month="2004-10" />
Select by keyword
<txp:article_custom sort="Posted desc" keywords="One" />
Select by author
<txp:article_custom form="author_list" author="Parkling" />
the author_list article form might go thus.
Other tags used: permlink, title
The following is exactly equivalent to the above example:
<txp:article_custom author="Parkling"> <p><txp:permlink><txp:title /></txp:permlink></p> </txp:article_custom>
Combined with custom fields
This code will display articles that have a custom field named “colour” with a value “red”:
<txp:article_custom colour="red" />
<txp:article_custom sort="AuthorID asc, Posted asc" />
What this does…
uses the sort attribute to define values by which to order article output. In this case two values are declared. AuthorID asc first orders articles alphabetically by author names, then Posted desc orders them by date published (“desc” meaning newest to oldest).
Why you might do it…
Sorting is a powerful way to group articles (e.g., by author), and/or give priority to articles most recently published (typically better for your web site visitors).