A simple Textpattern plugin that produces a link to a file associated with an article, comparable with Textpattern’s <txp:article_image /> tag.


To install go to the ‘plugins’ tab under ‘admin’ and paste the plugin code into the ‘Install plugin’ box, ‘upload’ and then ‘install’. Finally activate the plugin. Please note that you will need to set-up a custom field to use for associating files with articles, unless you choose to embed the new tag in the article text; see the ‘Quick start’ guide below for further details.

Quick start

Use the following methods after the plug-in has been installed.

Method 1 – recommended
  1. Define a custom field, ‘Article file’, under preferences.
  2. Place the tag <txp:arc_article_file /> in a form where you want the download link to appear.
  3. Associate a file with an article by entering the Textpattern ID of the file, its filename, or its URL into the Article file field.
Method 2
  1. Enter <txp:arc_article_file file=“TXP file ID” /> into an article where you want the link to appear setting the file attribute the Textpattern ID of the file associated with the article, its filename, or its URL.


<txp:arc_article_file />

<txp:arc_article_file>Download file</txp:arc_article_file>




Attribute Description Default Example
file Textpattern’s file ID or filename, or the URL of the file, use if you want to override the custom field unset file=“13”
link Set to ‘1’ to link to file, ‘0’ to output filename only 1 link=“0”
wraptag HTML tag to be used as the wraptag, without brackets unset wraptag=“p”
class CSS class attribute for wraptag arc_article_file class=“download”
custom Name of the custom field containing file IDs associated with article Article file custom=“file”

The Details


  1. Martin Walker |


    Is there any way for this plugin to simply output the filename and without the < a href markup?


  2. Andy |

    Hi Martin, I’ve just tweaked the plugin to do what you want. Just feed it the attribute link=“0” to force it to output only the filename. Make sure you are using version 0.3 of the plugin to do this.