etc_link_to

21 January 2013, 16:05

A replacement for <txp:link_to_prev/next /> tags that respects any sort order. Can also output links to first/last/nth/current±nth article.

Requirements

Textpattern 4.5.4 or newer.

Usage

<txp:etc_link_to target="next" /> or <txp:etc_link_to target="prev" />.

<txp:etc_link_to target="first,-2,-1,+1,+2,last" break=",">
	<txp:title />(<txp:article_id />)
</txp:etc_link_to>

Attributes

  • target: prev,next,first,last,+n,-n,n (default: current article).
  • link: whether to wrap content in a tag (default 1).
  • limit: as usual.
  • offset: as usual. If set to *, the list will be centered (when possible) on the current article.
  • pageby: limit links to the current page (default unset).
  • wraptag: as usual (default empty).
  • break: as usual (default empty).
  • showalways: as usual (default 0).

Demo

Look at the dynamic article list on the left sidebar. It is done with

<txp:etc_link_to target="-4,-3,-2,-1,0,+1,+2,+3,+4" wraptag="ul" break="li" limit="5" offset="*">
	<txp:etc_link_title />
</txp:etc_link_to>

And this one will create a preview of the previous and next articles:

 <txp:article_custom wraptag="blockquote" break="article"
	id='<txp:etc_link_to target="prev,next" link="0" break=","><txp:article_id /></txp:etc_link_to>'
>
	<h3><txp:permlink><txp:title /></txp:permlink></h3>
	<txp:excerpt />
</txp:article_custom>

etc_pagination

Customizable pagination bar for articles and other lists.

File(s)