开发者

How can I show dates 10 years into the future?

I'm writing a science fiction Wo开发者_如何学运维rdpress blog set 10 years into the future. I basically need all posts to display as if they are 10 years from now.

Eg. posts needs to display as: February 7, 2021 instead of February 7, 2011

This will be for every post that I write.

How can I automatically add 10 years to every post date? (And where would I put that code?)

Currently, the Wordpress PHP is calling the date with <?php the_time(__('M j, Y')) ?>.

How would I have to change this?


Not sure that you can modify Wordpress to do it for you, but here's some quick code to do it yourself, using the strtotime function:

echo "Posted: ".date("M j, Y", strtotime("+10 years", $article_date));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜