typecho文章检测多久更新后失效,并且方便访客用户提示博主进行修改


通过一段简单的代码,我们可以实现在文章页面显示文章发布超过多久的提醒,方便自己及用户注意。下面就直接上代码。

直接在POST.PHP文件合适的位置放入以下代码:

<div class="j-alt warning">
本文最后更新于<?php echo date('Y年m月d日' , $this->modified);?>,已超过<?php echo floor((time()-($this->modified))/86400);?>天没有更新。如果文章内容或图片资源失效,请留言反馈,我会及时处理,谢谢!
</div>   

然后在CSS文件放入以下美化代码:

.j-alt {
    width: 100%;
    padding: 8px 15px 8px 35px;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    transition: opacity 0.2s;
    font-size: 13px;
    margin: 20px 0;
}
.j-alt.warning {
    background-color: #fdf6ec;
    color: #e6a23c;
}
.j-alt::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 10px;
    -webkit-transform: translateY(-50%);
    transform: translateY(-50%);
    width: 20px;
    height: 18px;
    vertical-align: top;
}
.j-alt.warning::before {
    background-image: url(图标地址);
    background-repeat: no-repeat;
    background-position: center center;
}

声明:GhostKylin‘S BLOG|版权所有,违者必究|如未注明,均为原创|本网站采用BY-NC-SA协议进行授权

转载:转载请注明原文链接 - typecho文章检测多久更新后失效,并且方便访客用户提示博主进行修改


你好!世界!XladminShell箱子仅供个人学习使用务必遵守《网络安全法》