Textpattern Dynamic Date

Textpattern does not seem to support dynamic dates intrinsically, so here is a workaround I use. In this case, it will show the full date if it’s not in the current year, otherwise skip the year part. This approach can certainly be used for more advanced styling as well.

1
2
3
4
5
6
7
if(posted(array('format'=>'%Y')) < date("Y"))
{
echo posted(array('format'=>'%b %d %Y, %R %p'));
}else
{
echo posted();
}