WordPress 网站页脚设置

BBigSun 评论176阅读模式

一、页脚设置存活时间

效果演示

WordPress 网站页脚设置

方法一:修改 WordPress 主题的 footer.php 实现

在footer.php文件的第13和14行之间插入以下代码。文章源自十年又十年-https://www.bbigsun.com/632.html

本站已苟活:<span id=span_dt_dt style="color: #2F889A;"></span>
<script language=javascript>function show_date_time(){
window.setTimeout("show_date_time()", 1000);
BirthDay=new Date("11/3/2022 00:00:00");
today=new Date();
timeold=(today.getTime()-BirthDay.getTime());
sectimeold=timeold/1000
secondsold=Math.floor(sectimeold);
msPerDay=24*60*60*1000
e_daysold=timeold/msPerDay
daysold=Math.floor(e_daysold);
e_hrsold=(e_daysold-daysold)*24;
hrsold=Math.floor(e_hrsold);
e_minsold=(e_hrsold-hrsold)*60;
minsold=Math.floor((e_hrsold-hrsold)*60);
seconds=Math.floor((e_minsold-minsold)*60);
span_dt_dt.innerHTML='<font style=color:#C40000>'+daysold+'</font> 天 <font style=color:#C40000>'+hrsold+'</font> 时 <font style=color:#C40000>'+minsold+'</font> 分 <font style=color:#C40000>'+seconds+'</font> 秒';
}
show_date_time();

方法二:WordPress 后台页脚配置项中通过 JS 代码实现

WordPress 网站页脚设置文章源自十年又十年-https://www.bbigsun.com/632.html

在页脚配置项中插入以下代码:文章源自十年又十年-https://www.bbigsun.com/632.html

<p style="text-align: center;">Copyright ©  十年又十年  版权所有.</p>
本站已苟活:<span id=span_dt_dt style="color: #2F889A;"></span>
<script language=javascript>function show_date_time(){
window.setTimeout("show_date_time()", 1000);
BirthDay=new Date("11/3/2022 00:00:00");
today=new Date();
timeold=(today.getTime()-BirthDay.getTime());
sectimeold=timeold/1000
secondsold=Math.floor(sectimeold);
msPerDay=24*60*60*1000
e_daysold=timeold/msPerDay
daysold=Math.floor(e_daysold);
e_hrsold=(e_daysold-daysold)*24;
hrsold=Math.floor(e_hrsold);
e_minsold=(e_hrsold-hrsold)*60;
minsold=Math.floor((e_hrsold-hrsold)*60);
seconds=Math.floor((e_minsold-minsold)*60);
span_dt_dt.innerHTML='<font style=color:#C40000>'+daysold+'</font> 天 <font style=color:#C40000>'+hrsold+'</font> 时 <font style=color:#C40000>'+minsold+'</font> 分 <font style=color:#C40000>'+seconds+'</font> 秒';
}
show_date_time();
</script>

将这句代码中的时间修改为实际建站时间文章源自十年又十年-https://www.bbigsun.com/632.html

BirthDay=new Date("11/3/2022 00:00:00");

二、页脚设置查询时间

添加查询耗时,在footer.php文件的第9和10行之间插入以下代码。文章源自十年又十年-https://www.bbigsun.com/632.html

<?php printf(' | 耗时 %.3f 秒 | 查询 %d 次 | 内存 %.2f MB',timer_stop( 0, 3 ),get_num_queries(),memory_get_peak_usage() / 1024 / 1024);?>
文章源自十年又十年-https://www.bbigsun.com/632.html文章源自十年又十年-https://www.bbigsun.com/632.html

纸上得来终觉浅,绝知此事要躬行。

weinxin
17688689121
我的微信
微信扫一扫
BBigSun
  • 本文由 BBigSun 发表于 2023年 10月 19日 08:29:55
  • 转载请务必保留本文链接:https://www.bbigsun.com/632.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定