优化日志

25次阅读
2 条评论

共计 1672 个字符,预计需要花费 5 分钟才能阅读完成。

中文 英文 韩语 日语

优化日志

  • 优化缓存功能——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');


了解 一个 HR 的更多信息

订阅后即可通过电子邮件收到最新文章。

正文完
 0
null
版权声明:本站原创文章,由 null 于2022-09-02发表,共计1672字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
0 0 投票数
文章评分
订阅评论
提醒
guest

2 评论
最多投票
最新 最旧
内联反馈
查看所有评论
AI 助手