posted
From Textpattern CMS User Documentation
<txp:posted />
The posted tag is a single tag which is used to return the publish date of the article being displayed. The format is determined by the settings specified in the Date Format, or Archive Date Format, fields on the Basic Preferences tab.
Contents |
Attributes
Tag will accept the following attributes (case-sensitive):
- format="format string"
- Override the default date format set in the preferences.
- Values: any valid strftime() string values,
since,iso8601,w3cdtf, orrfc822. - Default: unset (date format set via preferences).
- gmt="boolean"
- Return either local time according to the set time zone preferences or GMT time.
- Default:
0(local time set in preferences). - wraptag="tag"
- HTML tag surrounding the posted date, without brackets.
- Default: unset.
- class="class name"
- CSS class name which will be applied to the
wraptagelement. - Default: unset.
- lang="ISO language code"
- Format time string suitable for the specified language (locale).
- Values: locales adhere to ISO-639.
- Default: unset (time format set via preferences).
Examples
Example 1: "since" format date setting
<p>Posted: <txp:posted format="since" /></p>
would result in:
<p>Posted: 29 days ago</p>
Example 2: Custom format date setting
<p>Posted: <txp:posted format="%b %d, %Y" /></p>
would result in:
<p>Posted: Sep 18, 2008</p>
Example 3: Extended custom format date setting
<p>Posted: <txp:posted format="%Y" wraptag="span" class="year" /> <txp:posted format="%B" wraptag="span" class="month" /> <txp:posted format="%e" wraptag="span" class="day" /> </p>
would result in:
<p>Posted: <span class="year">2008</span> <span class="month">Sep</span> <span class="day">18</span> </p>
This provides styling hooks for each date part.
Genealogy
Version 4.0.4
-
classandwraptagadded




