<?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>葛小飞 &#187; Wordpress</title>
	<atom:link href="http://www.gexiaofei.com/tag/wordpress/feed" rel="self" type="application/rss+xml" />
	<link>http://www.gexiaofei.com</link>
	<description>惟愿生活简单前行</description>
	<lastBuildDate>Wed, 08 Apr 2009 15:48:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Wordpress 2.7 分页评论导致的SEO问题</title>
		<link>http://www.gexiaofei.com/20081218469.html</link>
		<comments>http://www.gexiaofei.com/20081218469.html#comments</comments>
		<pubDate>Thu, 18 Dec 2008 15:20:12 +0000</pubDate>
		<dc:creator>天眞</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[wordpress技巧]]></category>

		<guid isPermaLink="false">http://www.gexiaofei.com/?p=469</guid>
		<description><![CDATA[Wordpress 2.7的评论分页功能对于评论比较多的博客而言是个很好的功能，可以有效的减少页面体积，但是同时分页评论功能也会造成一个与SEO相关的问题——复制内容。wp-hackers邮件组里就有人指出这个问题了。
Isn&#8217;t this bad for SEO?  We now have a post with multiple pages, but
the post content is repeated over multiple URLs.  This will screw up
search engines, as well as site stats (popular posts will end up
&#8220;splitting the vote&#8221; between comment-page-1, comment-page-2, comment-page-3, etc&#8230;)
对于开启了分页评论的文章页面，wordpress是使用以下URL格式来对各个分页进行标记的：
http://example.com/my-post-permalink/ （文章页面主页）
http://example.com/my-post-permalink/comment-page-1/ （评论分页第一页）
http://example.com/my-post-permalink/comment-page-2/（评论分页第二页）
这几个页面的主体内容其实是一样的，页面文字除了具体评论有变化外其余的都一样，title是一样的，meta内容也是一样的。所以就有人质疑，分页评论是否会为Wordpress2.7博客增加复制内容这一SEO问题。
现在提供一个解决办法，通过在Wordpress主题的fuctions.php里添加一段PHP代码就可以。这个代码解决复制内容的思路是让各评论分页与文章主页的post内容显示不一样，评论分页上只显示文章摘要。
[php]function seo_paged_comments_content_filter($t = &#8221;) {
$cpage = intval(get_query_var(&#8217;cpage&#8217;));
if ( [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Wordpress 2.7的评论分页功能对于评论比较多的博客而言是个很好的功能，可以有效的减少页面体积，但是同时分页评论功能也会造成一个与SEO相关的问题——复制内容。wp-hackers邮件组里就有人指出<a href="http://comox.textdrive.com/pipermail/wp-hackers/2008-December/023189.html">这个问题</a>了。</p>
<blockquote><p>Isn&#8217;t this bad for SEO?  We now have a post with multiple pages, but<br />
the post content is repeated over multiple URLs.  This will screw up<br />
search engines, as well as site stats (popular posts will end up<br />
&#8220;splitting the vote&#8221; between comment-page-1, comment-page-2, comment-page-3, etc&#8230;)</p></blockquote>
<p>对于开启了分页评论的文章页面，wordpress是使用以下URL格式来对各个分页进行标记的：<br />
http://example.com/my-post-permalink/ （文章页面主页）<br />
http://example.com/my-post-permalink/comment-page-1/ （评论分页第一页）<br />
http://example.com/my-post-permalink/comment-page-2/（评论分页第二页）<br />
这几个页面的主体内容其实是一样的，页面文字除了具体评论有变化外其余的都一样，title是一样的，meta内容也是一样的。所以就有人质疑，分页评论是否会为Wordpress2.7博客增加复制内容这一SEO问题。</p>
<p>现在提供一个解决办法，通过在Wordpress主题的fuctions.php里添加一段PHP代码就可以。这个代码解决复制内容的思路是让各评论分页与文章主页的post内容显示不一样，评论分页上只显示文章摘要。</p>
<p>[php]function seo_paged_comments_content_filter($t = &#8221;) {<br />
$cpage = intval(get_query_var(&#8217;cpage&#8217;));<br />
if ( ! empty( $cpage ) ) {<br />
remove_filter(&#8217;the_content&#8217;, &#8217;seo_paged_comments_content_filter&#8217;);<br />
$t = get_the_excerpt();<br />
$t .= sprintf(&#8217;
<p><a href="%1$s">%2$s</a></p>
<p>&#8216;, get_permalink(), get_the_title());<br />
}<br />
return $t;<br />
}<br />
add_filter(&#8217;the_content&#8217;, &#8217;seo_paged_comments_content_filter&#8217;);[/php]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gexiaofei.com/20081218469.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>美化Wordpress登陆页面</title>
		<link>http://www.gexiaofei.com/20081217464.html</link>
		<comments>http://www.gexiaofei.com/20081217464.html#comments</comments>
		<pubDate>Wed, 17 Dec 2008 15:01:01 +0000</pubDate>
		<dc:creator>天眞</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[wordpress技巧]]></category>

		<guid isPermaLink="false">http://www.gexiaofei.com/?p=464</guid>
		<description><![CDATA[在Wordpress 2.6的使用过程中，我也曾经对WP的登陆页面进行过自定义，包括修改其样式，或者改变页面内容。现在Wordpress升级到2.7了，WP开发者对登陆页面进行了一些改动，但是要实现登陆页面的美化还是不复杂的，Frank就提供了一个简单的方法。

首先，在你的主题的functions.php里添加以下代码，如果你的主题没有functions.php，可以自己建立一个。

function fb_custom_login() {
echo '&#60;link rel=&#34;stylesheet&#34; type=&#34;text/css&#34; href=&#34;' . get_bloginfo('template_directory') . '/custom-login/custom-login.css&#34; /&#62;';
}

add_action('login_head', 'fb_custom_login');

这是要求Wordpress对登陆页面使用独立的css样式表custom-login.css，该样式表是放在主题目录下的custom-login文件夹。
custom-login.css的内容可以自己做，完全可以打造出符合自己网站风格的Wordpress登陆页面来。如果比较懒惰，也可以使用以下的css

html {
background-color: #fff;
}

#login form {
padding-top: 100px;
}
#login form .submit input {
border-color: #bcb38f !important;
color: #777 !important;
}
#login form .submit input:hover {
border-color: #bcb38f !important;
color: #bcb38f !important;
}
#login h1 {
display: none;
}
.login #nav a {
color: #777 !important;
}
.login #nav a:hover {
color: #bcb38f !important;
}

#wphead img, #wphead h1 {
display: none;
}
#wphead {
height: 100px;
}
#wphead-info [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>在Wordpress 2.6的使用过程中，我也曾经对WP的登陆页面进行过自定义，包括修改其样式，或者改变页面内容。现在Wordpress升级到2.7了，WP开发者对登陆页面进行了一些改动，但是要实现登陆页面的美化还是不复杂的，Frank就提供了一个<a href="http://wpengineer.com/create-your-own-wordpress-login-design/">简单的方法</a>。<br />
<img src="http://wpengineer.com/blog/wp-content/uploads/wp27-login.png" alt="美化Wordpress登陆页面" /><br />
首先，在你的主题的functions.php里添加以下代码，如果你的主题没有functions.php，可以自己建立一个。</p>
<ol class="code">
<li><code>function fb_custom_login() {</code></li>
<li><code>echo '&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;' . get_bloginfo('template_directory') . '/custom-login/custom-login.css&quot; /&gt;';</code></li>
<li><code>}</code></li>
<li></li>
<li><code>add_action('login_head', 'fb_custom_login');</code></li>
</ol>
<p>这是要求Wordpress对登陆页面使用独立的css样式表custom-login.css，该样式表是放在主题目录下的custom-login文件夹。</p>
<p>custom-login.css的内容可以自己做，完全可以打造出符合自己网站风格的Wordpress登陆页面来。如果比较懒惰，也可以使用以下的css</p>
<ol class="code">
<li><code>html {</code></li>
<li><code>background-color: #fff;</code></li>
<li><code>}</code></li>
<li></li>
<li><code>#login form {</code></li>
<li><code>padding-top: 100px;</code></li>
<li><code>}</code></li>
<li><code>#login form .submit input {</code></li>
<li><code>border-color: #bcb38f !important;</code></li>
<li><code>color: #777 !important;</code></li>
<li><code>}</code></li>
<li><code>#login form .submit input:hover {</code></li>
<li><code>border-color: #bcb38f !important;</code></li>
<li><code>color: #bcb38f !important;</code></li>
<li><code>}</code></li>
<li><code>#login h1 {</code></li>
<li><code>display: none;</code></li>
<li><code>}</code></li>
<li><code>.login #nav a {</code></li>
<li><code>color: #777 !important;</code></li>
<li><code>}</code></li>
<li><code>.login #nav a:hover {</code></li>
<li><code>color: #bcb38f !important;</code></li>
<li><code>}</code></li>
<li></li>
<li><code>#wphead img, #wphead h1 {</code></li>
<li><code>display: none;</code></li>
<li><code>}</code></li>
<li><code>#wphead {</code></li>
<li><code>height: 100px;</code></li>
<li><code>}</code></li>
<li><code>#wphead-info {</code></li>
<li><code>padding-top: 27px;</code></li>
<li><code>}</code></li>
<li></li>
<li><code>#footer {</code></li>
<li><code>display: none;</code></li>
<li><code>}</code></li>
<li><code>#footer_custom {</code></li>
<li><code>clear: both;</code></li>
<li><code>text-align: center;</code></li>
<li><code>width: 500px;</code></li>
<li><code>margin: auto;</code></li>
<li><code>height: 100px;</code></li>
<li><code>}</code></li>
<li><code>#footer_custom .docs {</code></li>
<li><code>padding-top: 0px;</code></li>
<li><code>line-height: 100%;</code></li>
<li><code>}</code></li>
<li><code>#footer_image {</code></li>
<li><code>border:none;</code></li>
<li><code>}</code></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.gexiaofei.com/20081217464.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>easyComment：针对Wordpress的firefox快速评论插件</title>
		<link>http://www.gexiaofei.com/20081217461.html</link>
		<comments>http://www.gexiaofei.com/20081217461.html#comments</comments>
		<pubDate>Wed, 17 Dec 2008 03:02:12 +0000</pubDate>
		<dc:creator>天眞</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[firefox插件]]></category>

		<guid isPermaLink="false">http://www.gexiaofei.com/?p=461</guid>
		<description><![CDATA[对于每天都在不同博客间留言的朋友来说，每次想要评论都要找到评论狂然后输入自己的信息是比较麻烦的事情。Firefox插件easyComment是个发表评论中毒用户的必备良药，可以实现在wordpress博客上One-Click评论留言。
在安装玩easyComment之后，点击firefox状态栏上的easycomment图标后会出现如图所示输入框。依次输入自己的内容后，就ok了。（Your message这栏不用填写，除非你每次留言都是同样的内容。。） 然后随便找个你经常上的wordpress博客，在任何文章页面的任何位置点击这个easycomment图标，easycomment插件会自动搜索评论框的位置并且自动输入你预填写的个人信息和内容，很是方便博客评论。
easycomment插件的具体介绍和下载地址在这里：http://blog.bf-itservice.de/82/easycomment-firefox-extension
]]></description>
			<content:encoded><![CDATA[<p></p><p>对于每天都在不同博客间留言的朋友来说，每次想要评论都要找到评论狂然后输入自己的信息是比较麻烦的事情。Firefox插件easyComment是个发表评论中毒用户的必备良药，可以实现在wordpress博客上One-Click评论留言。</p>
<p><img src="http://www.gexiaofei.com/wp-content/uploads/2008/12/easycomment.gif" alt="easycomment" title="easycomment" width="457" height="526" class="alignleft size-full wp-image-462" />在安装玩easyComment之后，点击firefox状态栏上的easycomment图标后会出现如图所示输入框。依次输入自己的内容后，就ok了。（Your message这栏不用填写，除非你每次留言都是同样的内容。。） 然后随便找个你经常上的wordpress博客，在任何文章页面的任何位置点击这个easycomment图标，easycomment插件会自动搜索评论框的位置并且自动输入你预填写的个人信息和内容，很是方便博客评论。</p>
<p>easycomment插件的具体介绍和下载地址在这里：<a href="http://blog.bf-itservice.de/82/easycomment-firefox-extension">http://blog.bf-itservice.de/82/easycomment-firefox-extension</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gexiaofei.com/20081217461.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>创建基于Wordpress的OpenSearch应用</title>
		<link>http://www.gexiaofei.com/20081106369.html</link>
		<comments>http://www.gexiaofei.com/20081106369.html#comments</comments>
		<pubDate>Thu, 06 Nov 2008 15:09:58 +0000</pubDate>
		<dc:creator>天眞</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[OpenSearch]]></category>

		<guid isPermaLink="false">http://www.gexiaofei.com/?p=369</guid>
		<description><![CDATA[创建基于Wordpress的OpenSearch应用，直接在浏览器中搜索Wordpress博客。]]></description>
			<content:encoded><![CDATA[<p></p><p>Firefox和IE等浏览器的地址栏右边都有一个自带的搜索框，里面自带例如Google的搜索并且可以自己添加删除搜索引擎，这个就是OpenSearch的应用。关于OpenSearch的详细说明，可以查阅其<a href="http://www.opensearch.org/">官方网站</a>。使用OpenSearch技术应用，可以您的网站创建一个自定义搜索，访问者可以将网站搜索添加到他们的浏览器搜索栏中，此后就可以直接从他们的浏览器搜索栏中搜索网站内容，就像他们可以从同一界面上搜索Google或其他搜索引擎，而不需要单独打开网站页面。</p>
<p>Wordpress博客更加容易使用OpenSearch应用，因为其自身支持OpenSearch并且OpenSearch所需要的XML文件非常容易制作。譬如我的博客上就实现了OpenSearch，并且我添加到firefox浏览器中。<a href="http://www.gexiaofei.com/wp-content/uploads/2008/11/screenshot00073.jpg"><img src="http://www.gexiaofei.com/wp-content/uploads/2008/11/screenshot00073.jpg" alt="" title="OpenSearch" width="269" height="170" class="alignright size-medium wp-image-370" /></a></p>
<p>Wordpress使用OpenSearch应用的方法很简单，两步：首先，在Wordpress主题模板的header.php里加上代码<coolcode>
<link rel="search" type="application/opensearchdescription+xml" title="<?php bloginfo('name'); ?>&#8221; href=&#8221;<?php bloginfo('url'); ?>/os.xml&#8221; /></coolcode><br />
然后创建一个os.xml文件并上传到博客根目录下就可以了。os.xml内容如下，根据各自网站进行修改就行。<br />
<coolcode><?xml version="1.0" encoding="UTF-8"?><br />
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"><br />
	<ShortName>天眞博客</ShortName><br />
	<Description>Search on gexiaofei.com blog.</Description><br />
	<Url type="text/html" method="get" template="http://www.gexiaofei.com/?s={searchTerms}"></Url><br />
	<Contact>gexiaofei@vip.qq.com</Contact><br />
	<LongName>Gexiaofei.com Blog Search</LongName><br />
	<Image height="16" width="16" type="image/x-icon">http://www.gexiaofei.com/favicon.ico</Image><br />
	<Tags>Weblog WordPress Webdevelopment</Tags><br />
	<Url type="application/atom+xml" template="http://www.gexiaofei.com/?q={searchTerms}&amp;pw={startPage?}&amp;format=atom"/><br />
	<Url type="application/rss+xml" template="http://http://www.gexiaofei.com/?q={searchTerms}&amp;pw={startPage?}&amp;format=rss"/><br />
	<Url type="text/html" template="http://http://www.gexiaofei.com/?q={searchTerms}&amp;pw={startPage?}"/><br />
	<Query role="example" searchTerms="blog"/><br />
	<Developer>Frank Bueltge</Developer><br />
	<Attribution><br />
	    Search data Copyright 2007, All Rights Reserved<br />
	</Attribution><br />
	<SyndicationRight>open</SyndicationRight><br />
	<AdultContent>false</AdultContent><br />
	<Language>de-DE</Language><br />
	<OutputEncoding>UTF-8</OutputEncoding><br />
	<InputEncoding>UTF-8</InputEncoding><br />
</OpenSearchDescription></coolcode></p>
<p>这个应用对于一些站内搜索比较多的博客有用，可以很方便的让用户直接从浏览器中查找博客内容，而不需要每次登陆博客输入搜索。如果你感兴趣，可以添加我的博客搜索到你的firefox或者IE7，尝试一下是否方便很多。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gexiaofei.com/20081106369.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wordpress 2.7要来了</title>
		<link>http://www.gexiaofei.com/20081104365.html</link>
		<comments>http://www.gexiaofei.com/20081104365.html#comments</comments>
		<pubDate>Tue, 04 Nov 2008 14:25:30 +0000</pubDate>
		<dc:creator>天眞</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.gexiaofei.com/?p=365</guid>
		<description><![CDATA[Wordpress 2.7 要来了，很多功能性的提升和互动的增强，只是个人博客用户到底会用到多少功能呢?]]></description>
			<content:encoded><![CDATA[<p></p><p>迟到的消息，今天看google reader才知道Wordpress 2.7要来了。Wordpress的这次更新据说<a href="http://codex.wordpress.org/Version_2.7">有很多的变化</a>，功能方面也有很大的提高。我觉得除了基本效能方面的提升以外，对我这个一直没时间没内容更新的博客基本没有什么影响。</p>
<p>Thread Comments这个东西对于评论不多的网站用处并不大，尤其是要实现这种回复式评论需要对博客主题的comments.php文件进行很大的修改很有可能让一些人望而却步。针对评论的快捷键设置（Keyboard shortcuts）和评论分页也只有评论多的博客有用，对我么有用处哇:( 这次2.7的功能更新让我感觉wordpress已经逐渐抛弃人气弱的博客用户，因为这些功能所能带来的挫折感估计会很强，譬如我。。</p>
<p>从早期的wordpress用到现在，可以很明显的感觉到wordpress前进的步伐很快，除了用户体验和功能方面的提升，也更加重视互动的实现，博客平台本来就是个互动的平台，wordpress也越来越社会化了。不过个人博客平台能用到的功能到底有多少呢？</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gexiaofei.com/20081104365.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Wordpress技巧备忘</title>
		<link>http://www.gexiaofei.com/200803239.html</link>
		<comments>http://www.gexiaofei.com/200803239.html#comments</comments>
		<pubDate>Sun, 23 Mar 2008 12:17:13 +0000</pubDate>
		<dc:creator>天眞</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.gexiaofei.com/?p=9</guid>
		<description><![CDATA[Wordpress技巧备忘，包含linkroll控制、文章过滤以及单独分类搜索等等。]]></description>
			<content:encoded><![CDATA[<p></p><p>折腾了两天的wordpress 2.5，做出了两个wordpress模板，一个就是这个博客上用的Simjr,另外一个暂时不公布了。Simjr是比较简洁的主题，没有多加什么功能，但是在做另外个主题的时候要添加很多个性化的东西，所以查阅了一些老外的博客，收录了不少很酷的wordpress技巧，留存这里备忘。</p>
<ul>
<li>控制linkroll显示顺序</li>
<ol class="code">
<li><code>&lt;?php wp_list_bookmarks('title_li=&amp;orderby=description&amp;order=ASC&amp;categorize=0'); ?&gt;</code></li>
<li></li>
</ol>
<li>过滤单篇日志</li>
<p>如果某篇文章需要在wordpress博客文章列表、搜索结果或者其他任何地方不显示的话，可以使用下面语句。</p>
<ol class="code">
<li><code>&lt;?php if (have_posts()) : while (have_posts()) : the_post(); if( $post-&gt;ID == '179' ) continue; ?&gt;</code></li>
<li><code>&lt;?php the_content();?&gt;</code></li>
<li><code>&lt;?php endwhile;endif;?&gt;</code></li>
</ol>
<li>只有登陆会员可见内容</li>
<ol class="code">
<li><code>&lt;?php if (is_user_logged_in()) : ?&gt;</code></li>
<li class="indent1"><code>&lt;?php global $user_identity;get_currentuserinfo();?&gt;</code></li>
<li></li>
<li class="indent1"><code>&lt;p&gt;Welcome back &lt;?php echo $user_identity;?&gt;&lt;/p&gt;</code></li>
<li class="indent1"><code>&lt;p&gt;Here is a list of private pages only viewable by Members:&lt;/p&gt;</code></li>
<li class="indent2"><code>&lt;ul&gt;</code></li>
<li class="indent4"><code>&lt;?php wp_list_pages('title_li=&amp;child_of=20'); ?&gt;</code></li>
<li class="indent2"><code>&lt;/ul&gt;</code></li>
<li><code>&lt;?php else <img src='http://www.gexiaofei.com/wp-includes/images/smilies/icon_confused.gif' alt=':?' class='wp-smiley' /> &gt;</code></li>
<li class="indent1"><code>Welcome, visitor!</code></li>
<li><code>&lt;?php endif;?&gt;</code></li>
</ol>
<li>限制目录搜索</li>
<p>如果想让搜索只在某个目录分类下进行的话</p>
<ol class="code">
<li><code>&lt;form method=&quot;get&quot; id=&quot;searchform&quot; action=&quot;&lt;?php bloginfo('home'); ?&gt;/&quot;&gt;</code></li>
<li><code>&lt;div&gt;&lt;input type=&quot;text&quot; value=&quot;&lt;?php echo wp_specialchars($s, 1); ?&gt;&quot; name=&quot;s&quot; id=&quot;s&quot; /&gt;</code></li>
<li><code>&lt;input type=&quot;hidden&quot; name=&quot;cat&quot; value=&quot;22&quot; /&gt;</code></li>
<li><code>&lt;input type=&quot;submit&quot; id=&quot;searchsubmit&quot; value=&quot;Search&quot; /&gt;</code></li>
<li><code>&lt;/div&gt;</code></li>
<li><code>&lt;/form&gt;</code></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.gexiaofei.com/200803239.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>自定义WordPress数据库错误信息页面</title>
		<link>http://www.gexiaofei.com/20080101330.html</link>
		<comments>http://www.gexiaofei.com/20080101330.html#comments</comments>
		<pubDate>Tue, 01 Jan 2008 11:08:55 +0000</pubDate>
		<dc:creator>天眞</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.gexiaofei.com/blog/20080101278.html</guid>
		<description><![CDATA[Wordpress 2.3.2开始允许用户自定义数据库错误页面，这点对于虚拟主机数据库连接不稳定的wordpress用户来说很有用。]]></description>
			<content:encoded><![CDATA[<p></p><p>Wordpress 2.3.2版本允许用户自定义wordpress数据库错误信息页面，这个功能对于mysql主机不稳定的朋友来说是很有用的。当wordpress与数据库链接出现问题的时候，就会显示你的自定义内容，而不是wordpress自动的错误信息提示。</p>
<p>过程很简单，创建一个<code>db-error.php</code>页面，然后保存到<code>wp-content</code>目录下面就OK了。对这个页面，可以当成一个普通的页面进行创造，甚至运用CSS来装饰一下。最简单的wordpress数据库错误页面如下：</p>
<ol class="code">
<li><code>&lt;html&gt;</code></li>
<li><code>&lt;head&gt;</code></li>
<li><code>WORDPRESS数据库错误</code></li>
<li><code>&lt;/head&gt;</code></li>
<li><code>&lt;body&gt;</code></li>
<li><code>WORDPRESS数据库连接出现错误，请稍后访问。</code></li>
<li><code>&lt;/body&gt;</code></li>
<li><code>&lt;/html&gt;</code></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.gexiaofei.com/20080101330.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>仿校内的WordPress模板</title>
		<link>http://www.gexiaofei.com/20071230323.html</link>
		<comments>http://www.gexiaofei.com/20071230323.html#comments</comments>
		<pubDate>Sat, 29 Dec 2007 20:51:59 +0000</pubDate>
		<dc:creator>天眞</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.gexiaofei.com/blog/20071230267.html</guid>
		<description><![CDATA[将校内的模板移植到WORDPRESS上来，基本让WORDPRESS博客和校内界面和功能看上去有点类似。]]></description>
			<content:encoded><![CDATA[<p></p><p>花了一个晚上，把校内的模板偷到了WordPress上来了。还是没有完全做好，先抓图示意下。一直挺喜欢校内的样子的，过几天搬到博客上来。</p>
<p>校内模板首页：<br />
<a href='http://www.gexiaofei.com/wp-content/uploads/2007/12/xiaonei-index.jpg' title='仿校内的WORDPRESS模板首页'><img src='http://www.gexiaofei.com/wp-content/uploads/2007/12/xiaonei-index.jpg' alt='仿校内的WORDPRESS模板首页' /></a><br />
很喜欢校内左侧导航和下面的广告区块，都偷过来了，包括那个更多功能。</p>
<p>校内模板文章页面：<br />
<a href='http://www.gexiaofei.com/wp-content/uploads/2007/12/xiaonei-single.jpg' title='仿校内的WORDPRESS模板文章页面'><img src='http://www.gexiaofei.com/wp-content/uploads/2007/12/xiaonei-single.jpg' alt='仿校内的WORDPRESS模板文章页面' /></a><br />
抄袭的校内里面在看别人博客文章的时候会显示出作者的头像和相关信息。</p>
<p>校内模板评论界面：<br />
<a href='http://www.gexiaofei.com/wp-content/uploads/2007/12/xiaonei-comment.jpg' title='仿校内的WORDPRESS模板评论界面'><img src='http://www.gexiaofei.com/wp-content/uploads/2007/12/xiaonei-comment.jpg' alt='仿校内的WORDPRESS模板评论界面' /></a><br />
回复功能、表情功能。只是现在的表情图片太丑点，要把校内的表情图也偷过来。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gexiaofei.com/20071230323.html/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Wordpress自动升级脚本</title>
		<link>http://www.gexiaofei.com/20071106255.html</link>
		<comments>http://www.gexiaofei.com/20071106255.html#comments</comments>
		<pubDate>Tue, 06 Nov 2007 11:10:40 +0000</pubDate>
		<dc:creator>天眞</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[wordpress插件]]></category>

		<guid isPermaLink="false">http://www.gexiaofei.com/blog/20071106191.html</guid>
		<description><![CDATA[wordpress自动升级脚本，如果拥有服务器shell权限的话升级wordpress非常简单。]]></description>
			<content:encoded><![CDATA[<p></p><p>前几天用shell命令的时候一个失手，把服务器上一个存放多个英文网站的文件夹给删了，尸骨无存。最最郁闷的是这些网站的主题大多数都是我个性化修改过的，现在连个备份都没有了。重新做这些wordpress博客是很痛苦的，到现在也刚修复了两个。</p>
<p>网站资料丢失的事情我遇到过很多次了，最严重的是去年我们自己购买的服务器硬盘损坏，文件带数据库通通丢失。最郁闷的是，我从来没有在本地备份的习惯，所有的操作都是在服务器上进行。看来以后要好好改改这个坏习惯了。</p>
<p>在整理插件的过程中，<a href="http://planetozh.com/blog/2007/10/wordpress-upgrade-script/">发现</a>了一个很好用的wordpress自动升级脚本，非常好用。不过要使用这个wordpress脚本的前提是你需要有服务器的shell权限。</p>
<ol class="code">
<li><code>#!/bin/bash</code></li>
<li><code>CURDIR=$(pwd)</code></li>
<li><code>SITE=&quot;http://yoursite.com/blog&quot;</code></li>
<li><code>echo Updating Wordpress in $CURDIR</code></li>
<li><code>echo 1.  downloading latest build</code></li>
<li><code>wget -q http://wordpress.org/latest.tar.gz</code></li>
<li><code>echo 2.  unpacking latest build</code></li>
<li><code>tar zxf latest.tar.gz</code></li>
<li><code>cd wordpress/</code></li>
<li><code>echo 3.  replacing old files with fresh ones</code></li>
<li><code>tar cf - . | (cd $CURDIR; tar xf -)</code></li>
<li><code>echo 4.  updating your blog</code></li>
<li><code>wget -q -O - ${SITE}/wp-admin/upgrade.php?step=1&gt; /dev/null</code></li>
<li><code>echo 5.  removing unneeded files and directory</code></li>
<li><code>rm -f ../latest.tar.gz</code></li>
<li><code>echo 6.  all done !</code></li>
</ol>
<p>手动过程很简单，把文件保存名为<code>updatewp</code>（不带文件名后缀），放到wordpress根目录下，修正文件权限<code>chmod +x updatewp</code>，最后输入<code> ./updatewp</code>就ok了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gexiaofei.com/20071106255.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>优化Wordpress博客加载速度</title>
		<link>http://www.gexiaofei.com/20071019205.html</link>
		<comments>http://www.gexiaofei.com/20071019205.html#comments</comments>
		<pubDate>Fri, 19 Oct 2007 07:21:34 +0000</pubDate>
		<dc:creator>天眞</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[wordpress优化]]></category>

		<guid isPermaLink="false">http://www.gexiaofei.com/blog/20071019133.html</guid>
		<description><![CDATA[通过合并wordpress插件等的CSS和JS文件来提高wordpress博客的加载速度。]]></description>
			<content:encoded><![CDATA[<p></p><p>为了保证博客的个性化和功能需要，我在这个博客上使用了多个wordpress插件，另外还使用了google分析和雅虎统计来观察博客流量细节。这些插件和统计代码的使用很大程序上减缓了博客的打开速度。更重要的是博客主机服务商<a href="http://www.dreamhost.com/r.cgi?295188">Dreamhost</a>是在国外的，打开速度很大程序上影响了博客的正常阅读。通过网上查找以及自己研究，最终实现了博客加载速度的提升（反正我自己是比较满意&#8230;）。</p>
<p><img class="left" src='http://www.gexiaofei.com/wp-content/uploads/2007/10/wordpress-speedup.png' alt='wordpress提速' />从总体来说，网站页面提速主要可以从这几个方面入手：减少页面体积、加快页面元素加载、减少数据库查询、纯静态化页面生成等等。在这个博客上我主要使用了合并CSS和JS文件，优化JS加载的方法。在我优化之前，这个博客加载的CSS和JS如下图所示。<br />
<a rel="lightbox" href='http://www.gexiaofei.com/wp-content/uploads/2007/10/css.jpg' title='css和JSS加载'><img src='http://www.gexiaofei.com/wp-content/uploads/2007/10/css.jpg' alt='css和JSS加载' /></a></p>
<h3>合并wordpress和插件的CSS文件</h3>
<p>除了wordpress主题所需要的CSS文件，有些插件也会加载个性化定义，这样在打开博客的时候就需要调用多个css文件，合并多个CSS文件就可以加快这一进程。<br />
合并CSS很简单，只需要将页面调用的几个CSS文件综合到一个文件中独立调用就可以了。需要注意的是CSS中所调用的图片路径一定要调整正确。这个合并可以将插件的CSS合并到主题的css文件中去。</p>
<h3>合并JS文件</h3>
<p>我将coolcode.js合并到mootools.js中了。一般合并JS只需要将原JS文件中的代码拷贝到目标文件中就可以了。或者你可以使用<a href="http://zhiqiang.org/blog/420.html">阅微堂提供的方法</a>：<br />
建立一个新的all.js.php文件，内容是：</p>
<ol class="code">
<li><code>&lt;?php</code></li>
<li><code>require_once('&amp;#30446;&amp;#24405;/wp-blog-header.php' ) ;</code></li>
<li><code>include (&quot;/blog/a.js&quot; ) ;</code></li>
<li><code>include (&quot;/b.js&quot; ) ;</code></li>
<li><code>?&gt;</code></li>
</ol>
<p> 就是将header.php里面的那些js文件都include到all.js.php，然后在header里面包含all.js.php文件即可：</p>
<ol class="code">
<li><code>&lt;script xsrc=&quot;all.js.php&quot; type=&quot;text/javascript&quot; /&gt;</code></li>
</ol>
<p><span id="more-205"></span></p>
<h3>取消插件对其CSS和JS文件的自动加载</h3>
<p>合并了插件的CSS和JS文件后还没有完全结束。一般插件都会通过add_action(&#8217;wp_head&#8217;,&#8221; ) ;类似的语句将其自带的CSS、JS文件加载到wordpress head部分。我们需要需要插件文件，将对应的add_action语句注销掉。譬如我就注销掉了coolcode中的以下语句：</p>
<ol class="code">
<li><code>add_action('wp_head', array(&amp;$CoolCode, 'add_css'));</code></li>
<li><code>add_action('wp_head', array(&amp;$CoolCode, 'add_js'));</code></li>
</ol>
<h3>优化adsense广告加载</h3>
<p>google adsense的广告加载一直是影响网页打开速度的大问题。adsense优化加载的方法是从网上找到，不过把地址忘记了。adsense广告加载优化也算是<a href="http://www.gexiaofei.com/blog/20071017127.html">adsense优化</a>的一个方面了。</p>
<ol class="code">
<li><code>&lt;div id=&quot;delicious_loading&quot;&gt;loading...&lt;/div&gt;</code></li>
<li><code>&lt;div id=&quot;delicious_show&quot; style=&quot;display:none;&quot;&gt;&lt;/div&gt;</code></li>
</ol>
<p>在页面主循环结束语句前加入下面的代码：</p>
<ol class="code">
<li><code>&lt;div id=&quot;delicious_loaded&quot; style=&quot;display:none&quot;&gt;</code></li>
<li><code>&amp;#20320;&amp;#30340;google adsense&amp;#24191;&amp;#21578;&amp;#20195;&amp;#30721;</code></li>
<li><code>&lt;/div&gt;</code></li>
</ol>
<p>在合并了的js文件中加入以下代码：</p>
<ol class="code">
<li class="indent0"><code>function delicious() {</code></li>
<li></li>
<li class="indent2"><code>document.getElementById(&quot;delicious_loading&quot;).style.display = 'none';</code></li>
<li class="indent2"><code>document.getElementById(&quot;delicious_loaded&quot;).style.display = 'none';</code></li>
<li class="indent2"><code>document.getElementById(&quot;delicious_show&quot;).innerHTML=document.getElementById(&quot;delicious_loaded&quot;).innerHTML;</code></li>
<li class="indent2"><code>document.getElementById(&quot;delicious_show&quot;).style.display = 'block';</code></li>
<li class="indent1"><code>};</code></li>
<li></li>
<li class="indent1"><code>window.onload = delicious;</code></li>
</ol>
<p>这样google adsense广告只有在网站主体内容完全显示后才会出现，不会在网页打开过程中出现休克。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gexiaofei.com/20071019205.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
