wordpress链接google字体慢的完美解决教程
<p>因为google被屏蔽,所以很多运用了 fonts.googleapis的网站都打开很慢,会直到加载fonts.googleapis超时才能打开网页。网络上网友分享了很多方法,有在function.php后面加代码的,有用移除google字体插件的方法。但是,很多国外的主题在很多地方都运用了google字体,就会显得不太有效果。本方法主要通过插件,将谷歌字体等链接替换成360国内CDN链接,解决google在中国访问时常抽风影响到了google api和一些公共服务.</p><p><strong>工具/原料</strong></p>
<p>wordpress</p>
<p>火狐浏览器</p>
<p>googlefontsto3601.zip</p>
<p>联网环境</p>
<p><strong>方法/步骤</strong></p>
<p>近期因为google服务被屏蔽,导致很多wordpress用户网站打开极度缓慢,左下角一直提示加载fonts.googleapis或者其他的googleapis直到加载失败才能打开网页。导致打开一个网页至少要十多秒钟,严重影响用户体验</p>
<p align="center"><img alt="" src="https://img.jbzj.com/file_images/article/201412/2014122416433754.png" /></p>
<p>通过百度网盘(<a target="_blank" href="http://pan.baidu.com/s/1jGDsmSu">http://pan.baidu.com/s/1jGDsmSu</a>)下载googlefonts to 360插件</p>
<p align="center"><img alt="" src="https://img.jbzj.com/file_images/article/201412/2014122416433755.png" /></p>
<p> 登录wordpress后台,点击左侧 插件,选择安装插件。</p>
<p align="center"><img alt="" src="https://img.jbzj.com/file_images/article/201412/2014122416433756.png" /></p>
<p> 点击上传,再点击浏览选择下载好的插件包,再点击现在安装</p>
<p align="center"><img alt="" src="https://img.jbzj.com/file_images/article/201412/2014122416433757.png" /></p>
<p align="center"><img alt="" src="https://img.jbzj.com/file_images/article/201412/2014122416433758.png" /></p>
<p>安装好插件后,点击启用插件,刷新缓存。</p>
<p align="center"><img alt="" src="https://img.jbzj.com/file_images/article/201412/2014122416433759.png" /></p>
<p> 经过以上步骤,我们基本解决了因为google字体的原因导致的wordpress网站打开缓慢的问题。希望对您有帮助。</p>
<p align="center"><img alt="" src="https://img.jbzj.com/file_images/article/201412/2014122416433760.png" /></p>
<p>通过本方法,所有的googleapis都被替换为了useso,并且因为并没有删除字体,所以保持了博客原有的美观。原来google字体库被360搬到国内来了href='//fonts.useso.com/css?family=Open+Sans%3A300italic%2C400italic%2C600italic%2C300%2C400%2C600&#038;subset=latin%2Clatin-ext&#038;ver=3.8.1' type='text/css' media='all' /></p>
<p><strong>还有另外的方法 比如:</strong></p>
<p>在主题中的functions.php文件末尾加上一下代码之一即可</p>
<div class="codeText"><span style="CURSOR: pointer" class="copyCodeText" onclick="copyIdText('code_5966')">复制内容到剪贴板</span>
<div id="code_5966">
<ol style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; LIST-STYLE-TYPE: none; MARGIN-LEFT: 5px; BORDER-TOP: 0px; BORDER-RIGHT: 0px" class="dp-cpp">
<li class="alt"><span><span class="comment">// Remove Open Sans that WP adds from frontendif (!function_exists('remove_wp_open_sans')) : function remove_wp_open_sans() { wp_deregister_style( 'open-sans' ); wp_register_style( 'open-sans', false ); } add_action('wp_enqueue_scripts', 'remove_wp_open_sans'); // Uncomment below to remove from admin // add_action('admin_enqueue_scripts', 'remove_wp_open_sans');endif; </span><span> </span></span></li>
</ol>
</div>
</div>
<div class="codeText"><strong>注意事项</strong></div>
<p>期间进行特殊操作时候注意备份</p>
<p>以上就是wordpress链接google字体慢的完美解决教程,希望能对大家有所帮助!</p>
頁:
[1]