<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>FVF.me&#039;Ye &#187; 加速</title>
	<atom:link href="http://fvf.me/tag/%e5%8a%a0%e9%80%9f/feed" rel="self" type="application/rss+xml" />
	<link>http://fvf.me</link>
	<description>我是孤独的根号5</description>
	<lastBuildDate>Mon, 19 Sep 2011 12:10:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>加速wordpress</title>
		<link>http://fvf.me/wordpress/tips/speed-up-wordpress.html</link>
		<comments>http://fvf.me/wordpress/tips/speed-up-wordpress.html#comments</comments>
		<pubDate>Wed, 05 Aug 2009 08:09:06 +0000</pubDate>
		<dc:creator>死兔子</dc:creator>
				<category><![CDATA[小技巧]]></category>
		<category><![CDATA[加速]]></category>

		<guid isPermaLink="false">http://fvf.me/wordpress/%e5%8a%a0%e9%80%9fwordpress.html</guid>
		<description><![CDATA[一、减少查询数据库。 询数据库也许会花费比较多的时间，而有些东西是确定的，我们不需要查询数据库就知道应该是什么的。 &#60;meta http-equiv=&#34;Content-Type&#34; content=&#34;&#60;?php bloginfo(&#39;html_type&#39;); ?&#62;; charset=&#60;?php bloginfo(&#39;charset&#39;); ?&#62;&#34; /&#62; &#60;meta http-equiv=&#34;Content-Type&#34; content=&#34;text/html; charset=UTF-8&#34;/&#62; &#60;link rel=&#34;alternate&#34; type=&#34;application/rss+xml&#34; title=&#34;RSS 2.0 – all posts&#34; href=&#34;&#60;?php echo $feed; ?&#62;;&#34; /&#62; &#60;link rel=&#34;alternate&#34; type=&#34;application/rss+xml&#34; title=&#34;RSS 2.0 – all posts&#34; href=&#34;http://fvf.me/feed/&#34; /&#62; &#60;link rel=&#34;alternate&#34; type=&#34;application/rss+xml&#34; title=&#34;RSS 2.0 – all comments&#34; href=&#34;http://fvf.me/comments/feed/&#34; /&#62; &#60;link rel=&#34;pingback&#34; href=&#34;&#60;?php bloginfo(&#39;pingback_url&#39;); ?&#62;&#34; /&#62; &#60;link [...]]]></description>
			<content:encoded><![CDATA[<p>一、减少查询数据库。    <br />询数据库也许会花费比较多的时间，而有些东西是确定的，我们不需要查询数据库就知道应该是什么的。</p>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;meta</span> <span style="color: rgb(255, 255, 0); ">http-equiv=</span><span style="color: rgb(187, 187, 0); ">&quot;Content-Type&quot;</span> <span style="color: rgb(255, 255, 0); ">content=</span><span style="color: rgb(187, 187, 0); ">&quot;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(192, 192, 192); ">bloginfo</span>(<span style="color: rgb(187, 187, 0); ">&#39;html_type&#39;</span>); <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(187, 187, 0); ">; charset=</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(192, 192, 192); ">bloginfo</span>(<span style="color: rgb(187, 187, 0); ">&#39;charset&#39;</span>); <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(187, 187, 0); ">&quot;</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">/&gt;</span> <br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;meta</span> <span style="color: rgb(255, 255, 0); ">http-equiv=</span><span style="color: rgb(187, 187, 0); ">&quot;Content-Type&quot;</span> <span style="color: rgb(255, 255, 0); ">content=</span><span style="color: rgb(187, 187, 0); ">&quot;text/html; charset=UTF-8&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">/&gt;</span> <br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;link</span> <span style="color: rgb(255, 255, 0); ">rel=</span><span style="color: rgb(187, 187, 0); ">&quot;alternate&quot;</span> <span style="color: rgb(255, 255, 0); ">type=</span><span style="color: rgb(187, 187, 0); ">&quot;application/rss+xml&quot;</span> <span style="color: rgb(255, 255, 0); ">title=</span><span style="color: rgb(187, 187, 0); ">&quot;RSS 2.0 – all posts&quot;</span> <span style="color: rgb(255, 255, 0); ">href=</span><span style="color: rgb(187, 187, 0); ">&quot;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(204, 204, 0); ">$feed</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(187, 187, 0); ">;&quot;</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">/&gt;</span> <br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;link</span> <span style="color: rgb(255, 255, 0); ">rel=</span><span style="color: rgb(187, 187, 0); ">&quot;alternate&quot;</span> <span style="color: rgb(255, 255, 0); ">type=</span><span style="color: rgb(187, 187, 0); ">&quot;application/rss+xml&quot;</span> <span style="color: rgb(255, 255, 0); ">title=</span><span style="color: rgb(187, 187, 0); ">&quot;RSS 2.0 – all posts&quot;</span> <span style="color: rgb(255, 255, 0); ">href=</span><span style="color: rgb(187, 187, 0); ">&quot;http://fvf.me/feed/&quot;</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">/&gt;</span> <br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;link</span> <span style="color: rgb(255, 255, 0); ">rel=</span><span style="color: rgb(187, 187, 0); ">&quot;alternate&quot;</span> <span style="color: rgb(255, 255, 0); ">type=</span><span style="color: rgb(187, 187, 0); ">&quot;application/rss+xml&quot;</span> <span style="color: rgb(255, 255, 0); ">title=</span><span style="color: rgb(187, 187, 0); ">&quot;RSS 2.0 – all comments&quot;</span> <span style="color: rgb(255, 255, 0); ">href=</span><span style="color: rgb(187, 187, 0); ">&quot;http://fvf.me/comments/feed/&quot;</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">/&gt;</span><br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;link</span> <span style="color: rgb(255, 255, 0); ">rel=</span><span style="color: rgb(187, 187, 0); ">&quot;pingback&quot;</span> <span style="color: rgb(255, 255, 0); ">href=</span><span style="color: rgb(187, 187, 0); ">&quot;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(192, 192, 192); ">bloginfo</span>(<span style="color: rgb(187, 187, 0); ">&#39;pingback_url&#39;</span>); <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(187, 187, 0); ">&quot;</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">/&gt;</span> <br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;link</span> <span style="color: rgb(255, 255, 0); ">rel=</span><span style="color: rgb(187, 187, 0); ">&quot;pingback&quot;</span> <span style="color: rgb(255, 255, 0); ">href=</span><span style="color: rgb(187, 187, 0); ">&quot;http://fvf.me/wordpress/xmlrpc.php&quot;</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">/&gt;</span> <br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/meta&gt;</span></div>
<p>这些关于你的博客名称，博客地址和RSS地址的函数有不要去查询数据库吗？总不能老是换地址和名称玩吧？所以如果我们可以把它写死，直接写上我们的地址名称，比如<a href="http://www.graygift.com/">Graygift@ye</a>。如果你不知道怎么改，可以查看你博客首页的源代码。 </p>
<p>另外，博客作者只有一个的话，那么&lt;?php the_author(); ?&gt;函数也没有存在的必要了。</p>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span> (<span style="color: rgb(204, 204, 0); ">$options</span><span style="color: rgb(192, 192, 192); ">[</span><span style="color: rgb(187, 187, 0); ">&#39;author&#39;</span><span style="color: rgb(192, 192, 192); ">])</span> <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;span</span> <span style="color: rgb(255, 255, 0); ">class=</span><span style="color: rgb(187, 187, 0); ">”author”</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(192, 192, 192); ">the_author_posts_link</span>(); <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/span&gt;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span></div>
<p>这个函数一般在index.php和single.php存在。<br />
  <br />按照这个思路，就可以改掉很多函数，达到减少查询数据库从而加速博客。如果不知道怎么改的话，可以查看页面的源代码，然后把原来的函数替换掉。 </p>
<p>二、压缩css和js </p>
<p>模板的css很大，js也是。再加上插件的css和js，这是在是个很大的负担。我们可以把css和js合并并压缩。 </p>
<p>下面说说怎么合并和压缩。 </p>
<p>1.我首先用到一个工具，firefox浏览器和它的一个功能强大的插件firebug。（firefox菜单-工具-附加组件-获取附件组件-在搜索框输入firebug查询-添加至firefox）。安装完成后我们再进行下一步。 </p>
<p>2.用firefox打开你的博客，在工具-firebug查看你的博客所加载的css和js。很多插件都会在 head 标签里插入自己的 CSS 文件，不信打开你的首页，看下源代码就知道。为了确定那些是自动加入的，你可以在你的主题中的 templates/start.php（header.php） 里查找：&lt;?php wp_head(); ?&gt;,将之更改为：</p>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(105, 105, 105); ">&lt;!--start--&gt;</span><br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(192, 192, 192); ">wp_head</span>(); <span style="color: rgb(255, 255, 255); ">?&gt;</span><br /> <span style="color: rgb(105, 105, 105); ">&lt;!--end--&gt;</span></div>
<p>3.然后用firefox打开你的博客，在工具-firebug查看你的博客所加载的，看看这两段注释里都多了什么东西。复制下来。然后改成</p>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(105, 105, 105); ">/*?&gt;&lt;?php wp_head(); ?&gt;&lt;?php */</span><span style="color: rgb(255, 255, 255); ">?&gt;</span></div>
<p>来注释掉这句。把网页代码中引用的 CSS 文件地址，复制到浏览器地址栏中打开，把代码复制，通通粘贴到你的主题 style.css 文件的末尾，用注释区分一下方便将来修改。要注意，有些插件的 CSS 里面定义了图片背景，你可以把插件中的图片目录移动到主题文件夹里面。比方说某插件里面有一句 url(images/loading.gif),你就可以把插件里面的 images 文件夹放到主题目录中与 style.css 所在的目录即可。<br />
  <br />4.把引用的JS 文件的语句统统从 header.php 里面剪切掉，粘贴到主题中的 footer.php 中的&lt;/body&gt; 前面。同样，你也可以对 JS 文件像对 CSS 文件一样进行合并，不过建议有把握再这么做。 </p>
<p>5.尽量使用图片较少的主题；尽量使用站内图片。至于广为流传的将主题中的一些判断及函数按执行结果写死的方法也不错，不过有了缓存插件，估计效果不是很大了。另外很多人喜欢在侧边栏放一些引用站外 JS 文件的挂件，还有统计代码等等；如果不是必要，最好不要加这些东西，加的话也尽量放在 footer.php 里面。</p>
<blockquote>
<p>（PS：提供一个压缩CSS的网站。在线压缩CSS代码不影响效果情况下，压缩CSS的代码，能提高网站的Loading速度。<a href="http://www.cssdrive.com/index.php/main/csscompressor">CSS Drive</a> ，<a href="http://tool.cncms.com.cn/JavaScript.php" class="broken_link">压缩JS 工具</a> 请预留原版方便日后修改！！！）</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://fvf.me/wordpress/tips/speed-up-wordpress.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

