wordpress:如何给新文章发布时显示NEW图标

选择index.php文件进行编辑操作,在<?php the_title();?>代码后面添加以下代码:

<?php
$t1=$post->post_date;
$t2=date("Y-m-d H:i:s");
$diff=(strtotime($t2)-strtotime($t1))/3600;
if($diff<72){echo "<img src='URL' alt='3天之内的文章'>";}?>

素材可以自己制作或者自己网上搜,图标大小就我这样大小的就行。