# 优化日志

- 连结：https://blog.guohao.asia/%e4%bc%98%e5%8c%96%e6%97%a5%e5%bf%97.html
- 发布时间：2022-09-02T10:30:17+08:00
- 作者：null

中文   英文   韩语   日语

# 优化日志

 * 优化缓存功能——20220827；
 * 优化评论功能，解决部分手机浏览器无法发布评论的问题——20220827；
 * 优化首页部分背景图片，压缩并改为本地存储——20220827；
 * 启用腾讯云 CDN——20220831；
 * 删除部分无用插件——20220831；
 * 通过自定义插件向 `functions.php` 添加函数——20220902
    - 实现主题升级或更换主题时 functions.php 内自定义代码不丢失
    - 实现 ` 个人说明 ` 部分支持 HTML 代码

    ```language-default
    <?php
    /* 
    Plugin Name: 模版函数扩展插件
    Description: 给主题模版函数库“functions.php”文件里添加功能，避免因主题升级或更换主题造成对 functions.php 文件的代码修改丢失 
    Author: <a href="https://blog.guohao.asia/" >NULL</a>
    */
    // Disables Kses only for textarea saves
    foreach (array('pre_term_description', 'pre_link_description', 'pre_link_notes', 'pre_user_description') as $filter) {remove_filter($filter, 'wp_filter_kses');
     }

        // Disables Kses only for textarea admin displays
    foreach (array('term_description', 'link_description', 'link_notes', 'user_description') as $filter) {remove_filter($filter, 'wp_kses_data');
    }
    ?>
    ```

 * 替换前端字体 -20220903

    ```language-default
    *:not([class*="icon"]):not(i) {font-family: Segoe UI, "Microsoft Yahei" !important;}
    ```

 * 修改首页元素显示条件，提升 PC 端及移动端显示效果 -20220903
 * 通过自定义插件向 `functions.php` 添加函数，解除大尺寸图片上传限制——20220905

    ```language-default
    // 禁用 WordPress 大图片（2560 大小）裁剪功能
    add_filter('big_image_size_threshold', '__return_false');
    ```

 * 替换代码高亮为 highlight.js-20220912

    ```language-default
    <link rel="stylesheet" href="/wp-content/highlight/styles/base16/onedark.min.css">		<!-- 引入代码深色背景 -->
    <script src="/wp-content/highlight/highlight.min.js"></script>							<!-- 引入代码高亮 js-->
    <script src="/wp-content/highlight/highlightjs-line-numbers/dist/highlightjs-line-numbers.min.js"></script>			<!-- 引入添加行号 js-->
    <script>
    	hljs.initHighlightingOnLoad();
    	hljs.initLineNumbersOnLoad();
    </script>
    ```

 * 增加首行缩进

    ```language-default
    //WordPress 文章首行缩进
    function Bing_paragraph_indentation($content){return str_replace( '<p', '<p style="text-indent:2em;"', $content);
    }
    add_filter('the_content', 'Bing_paragraph_indentation');
    ```

## Comments

### By: 匿名

- 连结：https://blog.guohao.asia/%e4%bc%98%e5%8c%96%e6%97%a5%e5%bf%97.html/#comment-2
- 发布时间：2022-09-03T10:10:04+08:00

测试评论功能

### By: 匿名

- 连结：https://blog.guohao.asia/%e4%bc%98%e5%8c%96%e6%97%a5%e5%bf%97.html/#comment-3
- 发布时间：2022-10-04T14:51:41+08:00

测试缓存功能对此插件的影响
