WordPress主题折腾日记

站点建设210.3K25字数 3433阅读11分26秒阅读模式

 

由于购买了一个不错的begin主题,现对修改的地方,重新整理了一下,做个记录。文章源自亦枫博客-https://yflad.cn/1051.html

 文章源自亦枫博客-https://yflad.cn/1051.html

2017年9月22日 00:29:57文章源自亦枫博客-https://yflad.cn/1051.html

1、主页页脚三栏更换回两栏

主题目录[code]style.css[/code],查找以下代码文章源自亦枫博客-https://yflad.cn/1051.html

  1. .footer-widget .widget {
  2.     background#555;
  3.     floatleft;
  4.     width: 50%;//三栏 33.333333%
  5.     padding: 0 20px;
  6.     bordernone;
  7.     box-shadow: none;
  8. }

 文章源自亦枫博客-https://yflad.cn/1051.html

2、首页左上角增加当前日期

主题目录[code]inc[/code]→[code]users[/code]→[code]user-prfile.php[/code],大概60h处,[code]wel_come') ); ?>[/code]后添加如下代码文章源自亦枫博客-https://yflad.cn/1051.html

展开收缩
文章源自亦枫博客-https://yflad.cn/1051.html

 文章源自亦枫博客-https://yflad.cn/1051.html

  1. < script type = "text/javascript" > today = new Date();
  2. var day;
  3. var date;
  4. var hello;
  5. hour = new Date().getHours();
  6. if (hour < 6) {
  7.     hello = ' 凌晨好! ';
  8. } else if (hour < 9) {
  9.     hello = ' 早上好!';
  10. } else if (hour < 12) {
  11.     hello = ' 上午好!';
  12. } else if (hour < 14) {
  13.     hello = ' 中午好! ';
  14. } else if (hour < 17) {
  15.     hello = ' 下午好! ';
  16. } else if (hour < 19) {
  17.     hello = ' 傍晚好!';
  18. } else if (hour < 22) {
  19.     hello = ' 晚上好! ';
  20. } else {
  21.     hello = '夜深了! ';
  22. }
  23. function GetCookie(sName) {
  24.     var arr = document.cookie.match(new RegExp("(^| )" + sName + "=([^;]*)(;|$)"));
  25.     if (arr != null) {
  26.         return unescape(arr[2])
  27.     };
  28.     return null;
  29. }
  30. var Guest_Name = decodeURIComponent(GetCookie('author'));
  31. var webUrlwebUrl = webUrl;
  32. if (Guest_Name != "null" && Guest_Name != "") {
  33.     hello = Guest_Name + ' , ' + hello + ' 欢迎回来。';
  34. }
  35. document.write(' ' + hello); < /script><span id="localtime"><script type="text/javascript ">today=new Date(); var tdate,tday, x,year; var x = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五","星期六");var MSIE=navigator.userAgent.indexOf("MSIE ");if(MSIE != -1){ year =(today.getFullYear());} else { year = (today.getYear()+1900);} tdateyear+ "年" + (today.getMonth() + 1 ) + "月" + today.getDate() + "日" + "" + x[today.getDay()];document.write(tdate);</script></span>"

文章源自亦枫博客-https://yflad.cn/1051.html

显示效果如图:WordPress主题折腾日记文章源自亦枫博客-https://yflad.cn/1051.html

 文章源自亦枫博客-https://yflad.cn/1051.html

3、美化blockquote的显示代码

  1. blockquote {
  2.     color#7da33c;
  3.     background#ecf2d6 url('/wp-content/themes/begin/img/sc_notice.png') -1px -1px no-repeat;
  4.     border1px solid #aac66d;
  5.     padding15px 15px 5px 35px;
  6.     margin: 0 0 15px 0;
  7.     width: 98%
  8. }

显示效果如下:文章源自亦枫博客-https://yflad.cn/1051.html

亦枫,亦枫博客,yflad.cn文章源自亦枫博客-https://yflad.cn/1051.html

 文章源自亦枫博客-https://yflad.cn/1051.html

4、美化“添加代码”按钮显示

主题目录[code]style.css[/code],查找修改文章源自亦枫博客-https://yflad.cn/1051.html

  1. .single-content code {
  2.     padding2px 4px;
  3.     color#d14;
  4.     background-color#fbfbfb;
  5.     border1px solid #e1e1e8;
  6.     word-break: break-all;
  7.     word-wrap: break-word;
  8.     font-size14px;
  9. }

 文章源自亦枫博客-https://yflad.cn/1051.html

5、给网站评论添加UA信息

相关链接:WordPress教程:给留言者增加UA信息和IP地址文章源自亦枫博客-https://yflad.cn/1051.html

效果显示如图:WordPress主题折腾日记文章源自亦枫博客-https://yflad.cn/1051.html

 文章源自亦枫博客-https://yflad.cn/1051.html

6、将留言Admin,设置成“博主”

主题目录[code]inc[/code]→[code]inc.php[/code],查找[code]author-admin[/code]文章源自亦枫博客-https://yflad.cn/1051.html

Admin 改成想改的。

 

7、将小站图标替换成阿里的图标库

 

8、修改评论框提示内容

主题目录[code]comments.php[/code],查找[code]comment-form-comment[/code]

在p标签内,添加如下代码:

  1. <textarea placeholder="欢迎来到亦枫博客,如果有疑问在这里留言!发言请遵守当地法律法规"id="comment" name="comment" rows="4" tabindex="1" onKeyDown="xx(this.form.comment,this.form.total,this.form.used,this.form.remain);" onKeyUp="xx(this.form.comment,this.form.total,this.form.used,this.form.remain);"></textarea>

文字自由替换

 

显示效果如图:WordPress主题折腾日记

 

9、页脚小工具网站运行时间

相关链接:WordPress教程:网站添加运行时间显示

 

显示效果如图:WordPress主题折腾日记

 

10、WordPress发布/更新文章、提交/审核评论自动清理腾讯云CDN缓存

 

11、为非友情链接添加nofollow属性的方法

4.8.2版本,打开wordpress\wp-admin\includes目录的meta-boxes.php,在第1059行下面添加:

展开收缩
  1. <tr>
  2.     <th scope="row"><?php _e('nofollow') ?></th>
  3.     <td><fieldset>
  4.         <label for="nofollow">
  5.         <input class="valinp" type="checkbox" name="professional" value="external nofollow" id="nofollow" <?php xfn_check('professional', 'nofollow'); ?> />
  6.         <?php _e('external nofollow') ?></label>
  7.     </fieldset></td>
  8. </tr>

显示效果如图:WordPress主题折腾日记

 

12、防垃圾评论

因为主题自带防垃圾留言评论,现删除Wordpress 程序根目录的[code]wp-comments-post.php[/code]程序文件

 

13、对较多地方进行改版

对较多地方进行改版,增加不少页面。

所以备份记录(2017年9月23日 06:34:10,[code]backup_yflad_170923[/code])

 

 

未完,待续....

继续阅读
扫扫关注公众号
weinxin
我的微信
扫扫体验小程序
weinxin
我的公众号
亦枫
  • 本文由 发表于 2017年9月22日 01:14:22
评论  2  访客  1  作者  1
    • 绿软吧(lvr8.com)
      绿软吧(lvr8.com) 4

      感谢分享

      • 亦枫
        亦枫

        首次记录2017年5月10日 012:20:20

      匿名

      发表评论

      匿名网友 填写信息

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

      确定

      取消