txp:article_custom

The article_custom tag is a Single Tag which provides a variety of custom options for article sorting, selecting, and display. Textpattern will replace this tag with one or more articles.

Unlike txp:article, article_custom will always return an article list, and is not context-sensitive. This means that, while txp:article can only see posts within the currently viewed section/category/author, etc, article_custom can see all posts from all sections, categories and authors, unless you restrict it via attributes (see below), and that context-sensitive navigation tags, such as txp:older and txp:newer, will not work.

Syntax

The article_custom tag has the following syntactic structure…

<txp:article_custom />

Attributes

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

id="article ID number"

Display specific article.

customfieldname"value"

Restrict to articles with specified value for specified custom field name. Replace “customfieldname” with the name of the custom field. Default is unset.

section="section name"

Restrict to articles from specified section. Default is unset, retrieves from all sections.

category="category name"

Restrict to articles from specified category. Default is unset, retrieves from all categories.

keywords="keyword(s)"

Restrict to articles with specified keyword(s). Default is unset.

excerpted="value"

Restrict to articles with/without an excerpt. Available values: y (yes, return only those containing an excerpt) or n (no, return all). Default is n (no, return all).

status="status"

Restrict to articles with specified status. Available values: draft, hidden, pending, live, sticky. Default value is live.

time="time"

Restrict to articles posted within specified timeframe. Available values: past, future, or any (both past and future). Default is past.

month="yyyy-mm"

Restrict to articles posted within the specified month. Default is unset.

author="author's name"

Restrict to articles by specified author. Default is unset.

sort="sort value(s)"

How to sort resulting list. Available values: ID (article id#), AuthorID (author), LastMod (date last modified), LastModID (author of last modification), Posted (date posted), Title, Category1, Category2, comments_count, Status, Section, Keywords, Image (article image id#), url_title, custom_1 through custom_10, rand() random. Default is Posted desc.

offset="integer"

The number of articles to skip. Default is 0.

limit="integer"

The number of articles to display. Default is 10.

allowoverride="boolean"

Whether to use override forms for the generated article list. Default is 0 (no).

form="form name"

Use specified form. Default is default.

Examples

Display a list of articles publish during November of 2004

<txp:article_custom form="month_list" sort="Section asc" month="2004-10" />

Display a list of articles that include "One" as a keyword

<txp:article_custom sort="Posted desc" keywords="One" />

Display a list of hyperlinked article titles by a specific 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 />

Will display articles that have a custom field named "colour" with a value "red"

<txp:article_custom colour="red" />

Sort articles by author (a-z) then by date (oldest to newest)

<txp:article_custom sort="AuthorID asc, Posted asc" />

Genealogy

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.txt · Last modified: 2008/02/02 06:06 by hcgtv

Home Page | User Forums | Driven by DokuWiki
Copyright © 2008 xPattern