wet_thumbfilter is a plugin for Textpattern which displays the thumbnails for articles’ images meeting various filter criteria, with an optional link to the articles.
Usage
<txp:wet_thumbfilter />
Required attributes
None.
Optional attributes
| attribute | description | default |
|---|---|---|
| category | Category filter, comma separated list | Empty |
| section | Section filter, comma separated list | Empty |
| offset | A positive integer number. The n-th article with an assigned image meeting the filter criteria will be used to determine the first returned thumbnail. | 0 |
| sortby | Article field to sort by. Use either “posted” , “LastMod” or other article properties. | posted |
| limit | Limits the amount of articles containing thumbnails. Set to “” (empty) to return all thumbnails matching the criteria. | 1 |
| first | Use only the first image for each article, even if there’s an image list containing more images. | Empty. |
| time | Filters articles by posting date. Possible values: past, future, any. |
past |
| sortdir | Sorting direction. Use either “asc” for ascending order, “desc” for descending order or “rand()” for random order. | desc |
| class | class attribute which will be applied to the to the wraptag. If wraptag is empty, this attribute will be applied to the <img> tag. |
wet_thumbfilter |
| align | align attribute which will be applied to the <img> tag. |
Empty |
| link | Link to article. Set to “0” to disable the thumbnail’s link to the article. | 1 |
| style | style attribute which will be applied to the <img> tag. |
Empty |
| wraptag | (X)HTML tag used to enclose the list. See Textbook for further reference. | Empty |
| break | This string will be used to separate list items. See Textbook for further reference. | Empty |
| label | This string will be prepended to the list. See Textbook for further reference. | Empty |
| labeltag | (X)HTML tag used to enclose the label. See Textbook for further reference. | Empty |
Sample use
| tag | function |
|---|---|
<txp:wet_thumbfilter category="events" /> |
displays the most recent thumbnail belonging to an article in the “events” category. |
<txp:wet_thumbfilter category="events" sortby="LastMod" offset="1" /> |
displays the thumbnail which is associated with an article out of the “events” category. Articles are sorted by the date of last modification. The article at offset 1 (i.e. the second) is chosen. |
<txp:wet_thumbfilter category="events,fairs" limit="3" wraptag="ul" break="li" label="Recent pics" labeltag="h3" /> |
displays the three most recent thumbnails from articles out of the “events” or “fairs” category. The thumbnails are embedded into an unordered list and labelled by a h3. |
A gallery of all articles thumbnails can be rendered by just one line plus a dash of CSS styling for the individual img tags:
<txp:wet_thumbfilter limit="" section="gallery" wraptag="ul" break="li" class="mygallery" />
You’d rather have div soup? Here we go:
<txp:wet_thumbfilter limit="" section="gallery" wraptag="div" break="div" class="mygallery" />
Short of cash? Why not put some AdSense between two rows of images?
<txp:wet_thumbfilter section="gallery" limit="4" /> <txp:output_form form="adsense" /> <txp:wet_thumbfilter section="gallery" limit="" offset="4" />
Alternatively, repeating this tag a number of times while increasing the offset attribute will allow full control of the used HTML markup:
<ul class="gallery"> <li><txp:wet_thumbfilter category="events" offset="0" /></li> <li><txp:wet_thumbfilter category="events" offset="1" /></li> <li><txp:wet_thumbfilter category="events" offset="2" /></li> </ul>
This snippet can be part of another article, a page template, or a misc form as well.
Theory abounds, so let’s see a live sample. This thumbnail gallery is rendered from this site’s content, linking to the three most recent articles categorized as “textpattern”.
<txp:wet_thumbfilter category="textpattern" limit="3" wraptag="ul" break="li" />
Licence
This plugin is released under the Gnu General Public Licence.
Download
Get it here: wet_thumbfilter.txt.
Resources and Relateds
Express your suggestions, report bugs and discuss enhancements in this thread in the Textpattern forum.
Change log
| Date | Version | Notes |
|---|---|---|
| 2005-12-14 | 0.1 | Initial release |
| 2005-12-15 | 0.2 | Add link capability, restrict selection to either live or sticky articles |
| 2005-12-22 | 0.3 | Add limit attribute and various output modifier attributes for that list mode |
| 2006-01-01 | 0.4 | Supports comma separated lists of multiple sections, categories and article images |
| 2006-09-22 | 0.5 | Added first attribute |
| 2006-11-05 | 0.6 | Added time attribute. Requires Textpattern 4.0.4+. |



alex
16. Dezember 2005, 22:53
Robert Wetzlmayr
17. Dezember 2005, 08:51
Robert Wetzlmayr
22. Dezember 2005, 23:35
alex
23. Dezember 2005, 00:16