标签: 优化

  • 优化日志

    优化日志

    优化日志

    • 优化缓存功能——20220827;
    • 优化评论功能,解决部分手机浏览器无法发布评论的问题——20220827;
    • 优化首页部分背景图片,压缩并改为本地存储——20220827;
    • 启用腾讯云CDN——20220831;
    • 删除部分无用插件——20220831;
    • 通过自定义插件向functions.php添加函数——20220902
      • 实现主题升级或更换主题时functions.php内自定义代码不丢失
      • 实现个人说明部分支持HTML代码
    <?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
    *:not([class*="icon"]):not(i) {
    font-family: Segoe UI, "Microsoft Yahei" !important;
    }
    • 修改首页元素显示条件,提升PC端及移动端显示效果-20220903
    • 通过自定义插件向functions.php添加函数,解除大尺寸图片上传限制——20220905
    //禁用WordPress大图片(2560大小)裁剪功能
    add_filter( 'big_image_size_threshold', '__return_false' );
    • 替换代码高亮为highlight.js-20220912
    <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>
    • 增加首行缩进
    //WordPress 文章首行缩进
    function Bing_paragraph_indentation( $content ){
        return str_replace( '<p', '<p style="text-indent:2em;"', $content );
    }
    add_filter( 'the_content', 'Bing_paragraph_indentation' );
AI 助手