<txp:article_custom /> sing/cont tag, 15 attributes


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:

...contained statements...

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


  • Display the specific article or list of articles (each ID separated by a comma).
  • IMPORTANT: When a list is supplied, this does not imply a sort order.
  • Restrict to articles with specified value for specified custom field name.
  • Replace “customfieldname” with the name of the custom field.
section="retrieves all sections"
  • Restrict to articles from specified section(s).
  • Value: (comma separated list of) section name(s).
category="retrieves all categories"
  • Restrict to articles from specified category/ies. Note: the category names may be different to the Title you typed when you created the category, as the names are sanitized for URL use. Check the Categories tab to ensure you are using the correct names.
  • Value: (comma separated list of) category name(s).
  • Restrict to articles with specified keyword(s).
  • Restrict to articles with/without an excerpt.
  • Value: y (yes, return only those containing an excerpt).
  • Restrict to articles with the specified status.
  • Values: live or sticky.
  • Restrict to articles posted within specified timeframe.
  • Values: past, future, or any (both past and future).
month="unset" (yyyy, yyyy-mm, yyyy-mm-dd)
  • Restrict to articles posted within the specified year/month/day.
author="retrieves all authors"
  • Restrict to articles by specified author(s).
  • Value: (comma separated list of) author name(s).
sort="Posted desc"
  • Values
    • ID (article id#)
    • Posted (date posted)
    • Expires (expiry date)
    • AuthorID (author name)
    • LastMod (date last modified)
    • LastModID (author name of last modification)
    • Title
    • Image (article image id#)
    • Category1
    • Category2
    • comments_count
    • Status
    • Section
    • Keywords
    • url_title
    • custom_1 through custom_10
      • Note: Each field in the “textpattern” table can be used as a sort key.
    • rand() (random)
  • Direction
    • asc (ascending)
    • desc (descending)
offset="0" (integer)
  • The number of articles to skip.
limit="10" (integer)
  • The number of articles to display.
allowoverride="0" (boolean)
  • Whether to use override forms for the generated article list.
  • Use specified form.


  • Label prepended to item (or as first list item, where appropriate).
  • if wraptag is available and is set to ol or ul, the label will be the first list item.
  • (X)HTML tag (without brackets) to wrap around label.
  • (X)HTML tag (without brackets) or string to separate list items.
  • (X)HTML tag (without brackets) to wrap around the list.
  • (X)HTML class attribute to apply to the wraptag.



Version 4.0.7

  • Can be used as a container tag.
  • id can take a comma-separated list of IDs.
  • wraptag and break attributes added.

Version 4.0.6

  • support added for comma separated lists for section, category and author attributes

Version 4.0.4

  • listform deprecated (it never made a difference to article_custom anyway)
  • sort added (replaces sortby and sortdir)
  • sortby and sortdir deprecated
<txp:article_custom /> 6 examples

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.

<p><txp:permlink><txp:title /></txp:permlink></p>

Other tags used: permlink, title

Container tag

The following is exactly equivalent to the above example:

<txp:article_custom author="Parkling">
<p><txp:permlink><txp:title /></txp:permlink></p>

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" />

Article sorting

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