2024年05月29日 建站教程
wordpress建站中,如何判断文章是否为最新文章,如果是最新文章添加“news”样式,下面web建站小编给大家简单介绍一下!
具体代码如下:
<?php
$t1=$post->post_date;
$t2=date("Y-m-d H:i:s");
$diff=(strtotime($t2)-strtotime($t1))/3600;
if($diff<72){echo "New!";}
?>
本文链接:http://so.lmcjl.com/news/5529/