Textpattern CMS Template Tags

<txp:posted /> single tag, 5 attributes

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.

attributes

format="unset" 
  • Override the default date format set in the preferences.
  • Values: any valid strftime() string values, since, iso8601, w3cdtf, or rfc822.
gmt="0" (boolean) 
  • Return either local time according to the set time zone preferences or GMT time.
wraptag="unset" 
  • HTML tag surrounding the posted date, without brackets.
class="unset" 
  • CSS class name which will be applied to the wraptag element.
lang="unset" 
  • Format time string suitable for the specified language (locale).
  • Values: locales adhere to ISO-639.

genealogy

Version 4.0.4

  • class and wraptag added
<txp:posted /> 3 examples

“since” format date setting

<p>Posted: <txp:posted format="since" /></p>

would result in:

<p>Posted: 29 Days ago</p>

Custom format date setting

<p>Posted: <txp:posted format="%b %d, %Y" /></p>

would result in:

<p>Posted: Sep 18, 2008</p>

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.