本文最后更新于 259 天前,若内容或图片失效,请留言反馈。部分素材来自网络,若不小心影响到您的利益,请联系我们删除。


  • 如果是标准模板,打开 footer.php,把代码放到 </div> 之前即可。

  • 如果是 Argon 主题,直接添加到页脚设置区。

  • 演示效果如本站页脚效果所示。

  • 代码如下:(注意:修改代码中第11行的建站时间为你自己的)

<span id="momk"></span><span id="momk" style="color: #ff0000;"></span>
<script type="text/javascript">
function NewDate(str) {
str = str.split('-');
var date = new Date();
date.setUTCFullYear(str[0], str[1] - 1, str[2]);
date.setUTCHours(0, 0, 0, 0);
return date;
function momxc() {
var birthDay =NewDate("2020-3-12");
var today=new Date();
var timeold=today.getTime()-birthDay.getTime();
var sectimeold=timeold/1000
var secondsold=Math.floor(sectimeold);
var msPerDay=24*60*60*1000; var e_daysold=timeold/msPerDay;
var daysold=Math.floor(e_daysold);
var e_hrsold=(daysold-e_daysold)*-24;
var hrsold=Math.floor(e_hrsold);
var e_minsold=(hrsold-e_hrsold)*-60;
var minsold=Math.floor((hrsold-e_hrsold)*-60); var seconds=Math.floor((minsold-e_minsold)*-60).toString();
document.getElementById("momk").innerHTML = "本站已运行 "+daysold+" 天 "+hrsold+" 小时 "+minsold+" 分 "+seconds+" 秒";
setTimeout(momxc, 1000);



版权归属: E家之长
本文链接: https://www.5iehome.cc/archives/wordpress-show-running-time.html
许可协议: 本文使用《署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)》协议授权


  1. Windows Edge 108.0.1462.46
    2023-2-28 10:12:13

    For my thesis, I consulted a lot of information, read your article made me feel a lot, benefited me a lot from it, thank you for your help. Thanks!

  2. 8月前
    2023-4-23 1:53:30

    Your article helped me a lot, is there any more related content? Thanks!

  3. Windows Edge 108.0.1462.46
    2023-6-03 11:09:56

    I may need your help. I tried many ways but couldn’t solve it, but after reading your article, I think you have a way to help me. I’m looking forward for your reply. Thanks.

发送评论 编辑评论