wet_for_each_image: Textpattern image listing plugin

9. November 2006

Okay, you are definitely allowed to yawn: YAGP.

But this one’s different as it doesn’t doesn’t even render images: wet_for_each_image is a kind of master Textpattern CMS plugin whose only competence is to select images eligible for display, and then it delegates subsequent tasks to a worker markup whose duty is doing all of the hard work: accept formatting options from its master and render HTML for the images’ display. Image ids are passed into the worker markup by means of a special placeholder, {id}.

Considered selection criteria could be:

  • Image category lists, both for inclusion and exclusion
  • Maximum amount of images
  • Sort order


[... worker markup ...]


<txp:wet_for_each_image form="form-with-worker-markup" />

Confused? Skim over various instructional code snippets on wet_for_each_image’s sample page.

Required attributes


Optional attributes

attribute description default
category Category filter, comma separated list of included image categories. Current site category
exclude Category filter, comma separated list of excluded image categories. None
limit Limits the amount of images processed. Unlimited
offset A positive integer number. The image listing starts at this number. 0
sort Determines sort field and order. Possible values are e.g. “id asc”, “name desc” or any other valid SQL clause using one of the image table’s field names. None
thumb If set to “1”, restricts the processed image collection to solely images associated with a thumbnail. Empty
form A Textpattern form which will be used to render the output. This form overrides any markup eventually contained inside this plugin’s tag. Empty
break This string will be used to separate each image’s output. See Textbook for further reference. Empty
class class attribute which will be applied to the to the wraptag. wet_for_each_image
label This string will be prepended to the image list. See Textbook for further reference. Empty
labeltag (X)HTML tag used to enclose the label. See Textbook for further reference. Empty
wraptag (X)HTML tag used to enclose the image list. See Textbook for further reference. Empty


wet_for_each_image was inspired by a brain storming e-mail exchange with Matthew Smith, the fine artist from Squared Eye Designs.


This plug-in is released under the Gnu General Public Licence.


Get it here: wet_for_each_image.txt. Requires Textpattern 4.0.4+.

Resources and Relateds

Express your suggestions, report bugs and discuss enhancements in this thread in the Textpattern forum.

Change log

Date Version Notes
2006-11-09 0.2 Initial public release
2006-11-09 0.4 Added form attribute. Made category attribute default to the current category as specified in the URL.
2008-10-14 0.5 Fixed a bug related to the order attribute.