主题修改折腾

记录修改过的地方,出现相关问题方便快速定位,减少无意义的重复劳动。
1、实现文章编辑标签的按钮,只需要在single.php相应的地方添加下列代码即可

<i class="fa fa-pencil-square-o" aria-hidden="true"></i>
<span class="edit"><?php edit_post_link('编辑', ' ', ' '); ?></span>

需要增加空格为 &nbsp;
2、在网站上显示已运行多少时间,本站使用如下代码。代码贴到footer.php即可

 <p>网站运行
 <SPAN id=span_dt_dt style="color: #0196e3;opacity:0.5;"></SPAN>
 <SCRIPT language=javascript>
 function show_date_time()//显示运行时间START
 {
 window.setTimeout("show_date_time()", 1000);
 BirthDay=new Date("2/22/2018 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=""+daysold+"天"+hrsold+"小时"+minsold+"分"+seconds+"秒";
 }
 show_date_time();//显示运行时间END
 </SCRIPT>
 </p>

参考:https://www.fczbl.vip/787.html
3、在安装 Download Monitor的时候由于报警告

Because your server is running on nginx, our .htaccess file can't protect your downloads.
Please add the following rules to your nginx config to disable direct file access:
location /wp-content/uploads/dlm_uploads {
deny all;
return 403;
}

直接使用WinSCP编辑服务器上的文件,结果..nginx.conf 只剩下空文件,
解决:安装包 conf 目录下就有,LNMP模式下是nginx.conf
4、使用WinSCP传送图片要使用“二進位檔”,否則網站不能正確讀取。
5、将统计信息显示在源代码中,而不出现页面的内容中:
< !--< ?php echo get_num_queries(); ?> queries in < ?php timer_stop(3); ?> seconds-->
注意为了文章正常显示添加了多余的空格,开启“Minify HTML”插件则不能显示..
参考:https://yusi123.com/2979.html

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注