SHESHUI.ME

Textpattern:copyright dates

最后更新 Jun 07, 2018

Textpattern:copyright dates

Strictly speaking, every time a text is amended, the particular year should appear in the copyright notice i.e ©2010, 2012 for which case there is a plugin.

The following code features another method without using a plugin.

Use PHP to echo the year

<txp:variable name="year" value='<txp:php>echo safe_strftime("%Y");</txp:php>' />
<txp:if_variable name="year" value='<txp:posted format="%Y" />'>
&copy; <txp:variable name="year" />
<txp:else />
&copy; <txp:posted format="%Y" /> - <txp:variable name="year" /> 
</txp:if_variable>

The code detects if the article was posted this year and would therefore display &copy 2014.

If it was posted any year before the current year of 2014, then it will display that year and the current one – i.e © 2009 – 2014.

via: txptips by Yiannis Colakides

Textpattern 文章专题

评论

comment

暂无留言。

* 先[预览],后[提交]。

目录