<?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://haozer.com/tag/wordpress/feed" rel="self" type="application/rss+xml" />
	<link>http://haozer.com</link>
	<description>为了逝去的纪念!</description>
	<lastBuildDate>Mon, 21 May 2012 12:11:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>更改固定链接样式</title>
		<link>http://haozer.com/permalink-redirect.html</link>
		<comments>http://haozer.com/permalink-redirect.html#comments</comments>
		<pubDate>Sat, 30 Jul 2011 11:43:57 +0000</pubDate>
		<dc:creator>浩子</dc:creator>
				<category><![CDATA[杂碎|Mess]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[博客]]></category>

		<guid isPermaLink="false">http://haozer.com/?p=194</guid>
		<description><![CDATA[以前博客刚转到 WordPress 的时候，就固定链接样式百度、谷歌，论坛搜索……看看哪种比较好，但是众说纷纭，萝卜白菜各有所爱。昨天我做了个艰难的决定，更改固定链接样式为：/%postname%.html，至于你信不信，我反正改了。 之所以说更改固定链接样式是个艰难的决定，因为更改后博客就会有很多的死链，轻则给博友造成访问404，重则导致搜索引擎K站（好怕怕~）。所以更改固定链接样式后的链接301重定向就格外重要了，可以写 .htaccess 来实现跳转。以前以为不可以，以为只能用插件解决！找了2个大家用的比较多的： 插播AD： Ps.感谢翎峋大湿分享修改 .htaccess 来实现301跳转，参考：http://www.9mu.org/zhi/htaccess-301-rewrite.html 1、Permalink Redirect 官方地址：http://scott.yang.id.au/code/permalink-redirect/ 功能貌似很强大，我只用了其中一个 Permalink Redirect，更多用法见说明，推荐使用。 2、Dean's Permalinks Migration 官方地址：http://www.deanlee.cn/wordpress/permalinks-migration-plugin/ 就一个功能，对以前的固定链接形式做301跳转，但是我本地 WordPress 3.1.2和现在用的3.2.1版本均不能使用，不知道是主机问题还是 WordPress 程序不兼容的问题，囧。 坐等搜索引擎慢慢重新收录吧，悲催啊。 相关日志博客2岁了 (23)博客换主题 (47)WordPress wp_title 模版标签 (111)WordPress 插件 CodeColorer (59)非常实用的 jQuery 验证码 (73)WordPress 随机文章按钮 (33) 订阅浩子： 有道, 鲜果, 抓虾, 哪吒, 九点, QQ邮箱, Google, 邮件订阅]]></description>
			<content:encoded><![CDATA[<p>以前博客刚转到 WordPress 的时候，就固定链接样式百度、谷歌，论坛搜索……看看哪种比较好，但是众说纷纭，萝卜白菜各有所爱。昨天我做了个艰难的决定，更改固定链接样式为：<strong>/%postname%.html</strong>，至于你信不信，我反正改了。<span id="more-194"></span></p>
<p>之所以说更改固定链接样式是个艰难的决定，因为更改后博客就会有很多的死链，轻则给博友造成访问404，重则导致搜索引擎K站（好怕怕~）。所以更改固定链接样式后的链接301重定向就格外重要了，可以写 <a href="#comment-4690">.htaccess</a> 来实现跳转。<del>以前以为不可以，以为只能用插件解决！</del>找了2个大家用的比较多的：</p>
<blockquote><p>插播AD：<br />
Ps.感谢翎峋<strong>大湿</strong>分享修改 .htaccess 来实现301跳转，参考：http://www.9mu.org/zhi/htaccess-301-rewrite.html</p></blockquote>
<p><strong>1、Permalink Redirect</strong><br />
官方地址：http://scott.yang.id.au/code/permalink-redirect/<br />
功能貌似很强大，我只用了其中一个 Permalink Redirect，更多用法见说明，推荐使用。</p>
<p><strong>2、Dean's Permalinks Migration</strong><br />
官方地址：http://www.deanlee.cn/wordpress/permalinks-migration-plugin/<br />
就一个功能，对以前的固定链接形式做301跳转，但是我本地 WordPress 3.1.2和现在用的3.2.1版本均不能使用，不知道是主机问题还是 WordPress 程序不兼容的问题，囧。</p>
<p>坐等搜索引擎慢慢重新收录吧，悲催啊。</p>
<h3  class="related_post_title"><I><B>相关日志</B></I></h3><ul class="related_post"><li><a rel="bookmark" href="http://haozer.com/blog-two-years-old.html" title="博客2岁了">博客2岁了</a> (23)</li><li><a rel="bookmark" href="http://haozer.com/change-haozer-theme.html" title="博客换主题">博客换主题</a> (47)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-wp_title.html" title="WordPress wp_title 模版标签">WordPress wp_title 模版标签</a> (111)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-plugins-codecolorer.html" title="WordPress 插件 CodeColorer">WordPress 插件 CodeColorer</a> (59)</li><li><a rel="bookmark" href="http://haozer.com/jquery-buttoncaptcha.html" title="非常实用的 jQuery 验证码">非常实用的 jQuery 验证码</a> (73)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-random-button.html" title="WordPress 随机文章按钮">WordPress 随机文章按钮</a> (33)</li></ul><div style="margin: 0;">
				<script type="text/javascript"><!--
				google_ad_client = "ca-pub-4651455768821115";
				/* 336x280, 创建于 10-6-4 */
				google_ad_slot = "3240066453";
				google_ad_width = 336;
				google_ad_height = 280;
				//-->
				</script>
				<script type="text/javascript"
				src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
				</script>
				</div><div>
				<b><a href="http://feed.haozer.com" target="_blank" title="订阅 浩子 Feed">订阅浩子</a>：</b>
				<a rel="nofollow" target="_blank" href="http://reader.youdao.com/b.do?url=http://feed.haozer.com">有道</a>, 
				<a rel="nofollow" target="_blank" href="http://www.xianguo.com/subscribe.php?url=http://feed.haozer.com">鲜果</a>, 
				<a rel="nofollow" target="_blank" href="http://www.zhuaxia.com/add_channel.php?url=httP://feed.haozer.com">抓虾</a>, 
				<a rel="nofollow" target="_blank" href="http://inezha.com/add?url=http://feed.haozer.com/">哪吒</a>, 
				<a rel="nofollow" target="_blank" href="http://9.douban.com/reader/subscribe?url=http://feed.haozer.com">九点</a>, 
				<a rel="nofollow" target="_blank" href="http://mail.qq.com/cgi-bin/feed?u=http://feed.haozer.com">QQ邮箱</a>, 
				<a rel="nofollow" target="_blank" href="https://www.google.com/reader/view/feed/http://feed.haozer.com">Google</a>, 
				<a rel="nofollow" target="_blank" href="http://list.qq.com/cgi-bin/qf_invite?id=01d504b1f6e8f1ba7c8a5467797220449af8087f4200d8e7">邮件订阅</a>
				</div>]]></content:encoded>
			<wfw:commentRss>http://haozer.com/permalink-redirect.html/feed</wfw:commentRss>
		<slash:comments>70</slash:comments>
		</item>
		<item>
		<title>WordPress wp_title 模版标签</title>
		<link>http://haozer.com/wordpress-wp_title.html</link>
		<comments>http://haozer.com/wordpress-wp_title.html#comments</comments>
		<pubDate>Wed, 15 Jun 2011 15:36:51 +0000</pubDate>
		<dc:creator>浩子</dc:creator>
				<category><![CDATA[分享|Share]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://haozer.com/?p=190</guid>
		<description><![CDATA[一直以来，广大 WPer 都以 wordpress 强大模板引以为荣，选中自己喜欢的模板后，再进行微调至符合自己的口味。然后就是关注搜索引擎的收录，做相关的所谓 SEO 工作，比如优化标题、安装插件，但是有的模板默认的标题显示格式并不适合搜索引擎的口味，比如：博客标题》日志标题、所有分页页面标题都是博客标题、页面标题为博客标题》页面标题……这些都有个共同的特性就是博客标题显示在最前面，按照有些大湿的说法：重复标题是 SEO 大忌啊！有木有！ 今天为大家介绍的就是 wp_title 模版标签，有很多的人都知道，但是未必有好多的人都用上了。自从 wordpress 重新默认 TwentyTen 主题开始到现在的 TwentyEleven 主题，因为均为官方开发的主题，因此很有指导学习意义。里面参考主题 header.php 文件 &#60;title&#62; 的写法，主题无论是首页博客标题，还是文章日志标题、页面标题都进行了优化，具体大家可以切换至默认主题围观。 1、WordPress 3.0版本后默认主题 &#60;title&#62; 的写法，请编辑模板 header.php 文件： /* 用以下代码替换 header.php 文件 &#60;title&#62; */ &#60;title&#62;&#60;?php &#160; &#160; /* &#160; &#160; &#160;* Print the &#60;title&#62; tag based on what is being viewed. &#160; &#160; &#160;*/ &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>一直以来，广大 WPer 都以 wordpress 强大模板引以为荣，选中自己喜欢的模板后，再进行微调至符合自己的口味。然后就是关注搜索引擎的收录，做相关的所谓 SEO 工作，比如优化标题、安装插件，但是有的模板默认的标题显示格式并不适合搜索引擎的口味，比如：<strong>博客标题》日志标题</strong>、所有分页页面标题都是<strong>博客标题</strong>、页面标题为<strong>博客标题》页面标题</strong>……这些都有个共同的特性就是博客标题显示在最前面，按照有些大湿的说法：重复标题是 SEO 大忌啊！有木有！<span id="more-190"></span></p>
<p>今天为大家介绍的就是 wp_title 模版标签，有很多的人都知道，但是未必有好多的人都用上了。自从 wordpress 重新默认 TwentyTen 主题开始到现在的 TwentyEleven 主题，因为均为官方开发的主题，因此很有指导学习意义。里面参考主题 header.php 文件 &lt;title&gt; 的写法，主题无论是首页博客标题，还是文章日志标题、页面标题都进行了优化，具体大家可以切换至默认主题围观。</p>
<p>1、WordPress 3.0版本后默认主题 &lt;title&gt; 的写法，请编辑模板 header.php 文件：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:95%;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/* 用以下代码替换 header.php 文件 &lt;title&gt; */<br />
&lt;title&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">/*<br />
&nbsp; &nbsp; &nbsp;* Print the &lt;title&gt; tag based on what is being viewed.<br />
&nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$page</span><span style="color: #339933;">,</span> <span style="color: #000088;">$paged</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; wp_title<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'|'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'right'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Add the blog name.</span><br />
&nbsp; &nbsp; bloginfo<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'name'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Add the blog description for the home/front page.</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$site_description</span> <span style="color: #339933;">=</span> get_bloginfo<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'description'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'display'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$site_description</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span> is_home<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> is_front_page<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot; | <span style="color: #006699; font-weight: bold;">$site_description</span>&quot;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Add a page number if necessary:</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$paged</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">2</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$page</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">2</span> <span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">' | '</span> <span style="color: #339933;">.</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Page %s'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #990000;">max</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$paged</span><span style="color: #339933;">,</span> <span style="color: #000088;">$page</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">?&gt;</span><br />
&lt;/title&gt;</div></div>
<p>2、需要编辑模板 functions.php 文件的 &lt;title&gt; 的写法（实现效果和1效果一样）：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:95%;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/* 用以下代码替换 header.php 文件 &lt;title&gt; */<br />
&lt;title&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">/*<br />
&nbsp; &nbsp; &nbsp;* Print the &lt;title&gt; tag based on what is being viewed.<br />
&nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$page</span><span style="color: #339933;">,</span> <span style="color: #000088;">$paged</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; wp_title<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'|'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'right'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">?&gt;</span><br />
&lt;/title&gt;</div></div>
<p>将以下代码丢入模板 functions.php 文件：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:95%;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">/* 将以下代码丢入 functions.php 文件 */</span><br />
<span style="color: #000000; font-weight: bold;">function</span> mytheme_filter_wp_title<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$title</span><span style="color: #339933;">,</span> <span style="color: #000088;">$separator</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Don't affect wp_title() calls in feeds.</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> is_feed<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$title</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// The $paged global variable contains the page number of a listing of posts.</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// The $page global variable contains the page number of a single post that is paged.</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// We'll display whichever one applies, if we're not looking at the first page.</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$paged</span><span style="color: #339933;">,</span> <span style="color: #000088;">$page</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> is_search<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// If we're a search, let's start over:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$title</span> <span style="color: #339933;">=</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Search results for %s'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&quot;'</span> <span style="color: #339933;">.</span> get_search_query<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Add a page number if we're on page 2 or more:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$paged</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">2</span> <span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$title</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot; <span style="color: #006699; font-weight: bold;">$separator</span> &quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Page %s'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$paged</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Add the site name to the end:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$title</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot; <span style="color: #006699; font-weight: bold;">$separator</span> &quot;</span> <span style="color: #339933;">.</span> get_bloginfo<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'name'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'display'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// We're done. Let's send the new title back to wp_title():</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$title</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Otherwise, let's start by adding the site name to the end:</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$title</span> <span style="color: #339933;">.=</span> get_bloginfo<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'name'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'display'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// If we have a site description and we're on the home/front page, add the description:</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$site_description</span> <span style="color: #339933;">=</span> get_bloginfo<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'description'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'display'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$site_description</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span> is_home<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> is_front_page<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$title</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot; <span style="color: #006699; font-weight: bold;">$separator</span> &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$site_description</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Add a page number if necessary:</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$paged</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">2</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$page</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">2</span> <span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$title</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot; <span style="color: #006699; font-weight: bold;">$separator</span> &quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Page %s'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #990000;">max</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$paged</span><span style="color: #339933;">,</span> <span style="color: #000088;">$page</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Return the new title to wp_title():</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$title</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
add_filter<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'wp_title'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'mytheme_filter_wp_title'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>因为上述2种方法实现效果一样，所以本人强烈推荐用第1种方法优化标题。当然网上也有某人写了满满一页的代码就为优化博客标题显示，或许也有效果，但是代码也忒多了，我就不推荐了，有兴趣请 Google 然后自己试验。</p>
<h3  class="related_post_title"><I><B>相关日志</B></I></h3><ul class="related_post"><li><a rel="bookmark" href="http://haozer.com/permalink-redirect.html" title="更改固定链接样式">更改固定链接样式</a> (70)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-plugins-codecolorer.html" title="WordPress 插件 CodeColorer">WordPress 插件 CodeColorer</a> (59)</li><li><a rel="bookmark" href="http://haozer.com/jquery-buttoncaptcha.html" title="非常实用的 jQuery 验证码">非常实用的 jQuery 验证码</a> (73)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-random-button.html" title="WordPress 随机文章按钮">WordPress 随机文章按钮</a> (33)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-related-posts-code.html" title="两种实现 WordPress 相关日志代码">两种实现 WordPress 相关日志代码</a> (23)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-email-form-code.html" title="用代码实现 WordPress 邮件表单">用代码实现 WordPress 邮件表单</a> (23)</li></ul><div style="margin: 0;">
				<script type="text/javascript"><!--
				google_ad_client = "ca-pub-4651455768821115";
				/* 336x280, 创建于 10-6-4 */
				google_ad_slot = "3240066453";
				google_ad_width = 336;
				google_ad_height = 280;
				//-->
				</script>
				<script type="text/javascript"
				src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
				</script>
				</div><div>
				<b><a href="http://feed.haozer.com" target="_blank" title="订阅 浩子 Feed">订阅浩子</a>：</b>
				<a rel="nofollow" target="_blank" href="http://reader.youdao.com/b.do?url=http://feed.haozer.com">有道</a>, 
				<a rel="nofollow" target="_blank" href="http://www.xianguo.com/subscribe.php?url=http://feed.haozer.com">鲜果</a>, 
				<a rel="nofollow" target="_blank" href="http://www.zhuaxia.com/add_channel.php?url=httP://feed.haozer.com">抓虾</a>, 
				<a rel="nofollow" target="_blank" href="http://inezha.com/add?url=http://feed.haozer.com/">哪吒</a>, 
				<a rel="nofollow" target="_blank" href="http://9.douban.com/reader/subscribe?url=http://feed.haozer.com">九点</a>, 
				<a rel="nofollow" target="_blank" href="http://mail.qq.com/cgi-bin/feed?u=http://feed.haozer.com">QQ邮箱</a>, 
				<a rel="nofollow" target="_blank" href="https://www.google.com/reader/view/feed/http://feed.haozer.com">Google</a>, 
				<a rel="nofollow" target="_blank" href="http://list.qq.com/cgi-bin/qf_invite?id=01d504b1f6e8f1ba7c8a5467797220449af8087f4200d8e7">邮件订阅</a>
				</div>]]></content:encoded>
			<wfw:commentRss>http://haozer.com/wordpress-wp_title.html/feed</wfw:commentRss>
		<slash:comments>111</slash:comments>
		</item>
		<item>
		<title>WordPress 插件 CodeColorer</title>
		<link>http://haozer.com/wordpress-plugins-codecolorer.html</link>
		<comments>http://haozer.com/wordpress-plugins-codecolorer.html#comments</comments>
		<pubDate>Sat, 21 May 2011 06:28:49 +0000</pubDate>
		<dc:creator>浩子</dc:creator>
				<category><![CDATA[分享|Share]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[代码]]></category>

		<guid isPermaLink="false">http://haozer.com/?p=186</guid>
		<description><![CDATA[俗话说无折腾，无 WordPress，既然折腾就要有效果，有代码，有分享。众所周知，WordPress 后台编辑器不是很理想，插入的代码它会自动给格式化，非常影响代码的可读性，大家复制、粘贴的时候也不爽，有时候用默认的编辑器贴出来的代码，别人复制过去用的时候就给出错了，囧。今天就分享个 WordPress 插件 CodeColorer，当然好多高手都知道了，勿拍砖啊。 其实 WordPress 插件库中有很多 NB 的人开发了很多的代码高亮插件，但是其中绝大多数插件是用 &#60;pre&#62; 标签展示代码，这种情况要是哪天不用插件了，那些代码不是就给惨不忍睹啊，也有插件用的 &#60;code&#62; 标签来展示代码，但是当别人用其它阅读器浏览时无法实现高亮效果等。CodeColorer 插件就不会出现上面的问题，此插件可以用 [ cc] 标签，还可以用自带的 &#60;code&#62; 标签来展示代码，而且在阅读器中还可以实现高亮效果。 CodeColorer 安装及使用 1、下载和上传插件文件到 wp-content/plugins/codecolorer 目录下； 2、到插件管理面板启用 CodeColorer 插件； 3、在下拉菜单的 "设置"-&#62;"CodeColorer" 下面按照自行设置插件； 4、在撰写日志或页面时，请首先点击编辑框右上部的“HTML 源代码”按钮，切换到“HTML 源代码”模式，然后使用[ cc lang="lang"]code[ /cc]或者这样&#60;code lang="lang"&#62;code&#60;/code&#62;的语法在您的文章或者评论中插入源代码，您可以省略 lang="lang" 部分，这种情况下，代码会被包含在代码块中，并不进行语法高亮显示。 CodeColorer 代码示例 /** &#160;* Comment &#160;*/ function hello&#40;&#41; &#123; &#160; echo &#34;Hello!&#34;; &#160; return [...]]]></description>
			<content:encoded><![CDATA[<p>俗话说无折腾，无 WordPress，既然折腾就要有效果，有代码，有分享。众所周知，WordPress 后台编辑器不是很理想，插入的代码它会自动给格式化，非常影响代码的可读性，大家复制、粘贴的时候也不爽，有时候用默认的编辑器贴出来的代码，别人复制过去用的时候就给出错了，囧。今天就分享个 WordPress 插件 CodeColorer，当然好多高手都知道了，勿拍砖啊。<span id="more-186"></span></p>
<p>其实 WordPress 插件库中有很多 NB 的人开发了很多的代码高亮插件，但是其中绝大多数插件是用 &lt;pre&gt; 标签展示代码，这种情况要是哪天不用插件了，那些代码不是就给惨不忍睹啊，也有插件用的 &lt;code&gt; 标签来展示代码，但是当别人用其它阅读器浏览时无法实现高亮效果等。CodeColorer 插件就不会出现上面的问题，此插件可以用 [ cc] 标签，还可以用自带的 &lt;code&gt; 标签来展示代码，而且在阅读器中还可以实现高亮效果。</p>
<p><strong>CodeColorer 安装及使用</strong><br />
1、下载和上传插件文件到 <tt>wp-content/plugins/codecolorer</tt> 目录下；<br />
2、到插件管理面板启用 CodeColorer 插件；<br />
3、在下拉菜单的 "设置"-&gt;"CodeColorer" 下面按照自行设置插件；<br />
4、在撰写日志或页面时，请首先点击编辑框右上部的“HTML 源代码”按钮，切换到“HTML 源代码”模式，然后使用[ cc lang="lang"]code[ /cc]或者这样&lt;code lang="lang"&gt;code&lt;/code&gt;的语法在您的文章或者评论中插入源代码，您可以省略 lang="lang" 部分，这种情况下，代码会被包含在代码块中，并不进行语法高亮显示。</p>
<p><strong>CodeColorer 代码示例</strong></p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:95%;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009933; font-style: italic;">/**<br />
&nbsp;* Comment<br />
&nbsp;*/</span><br />
<span style="color: #000000; font-weight: bold;">function</span> hello<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Hello!&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p><strong>CodeColorer 支持的语言</strong><br />
abap, actionscript, actionscript3, ada, apache, applescript, apt_sources, asm, asp, autoit, avisynth, bash, basic4gl, bf, bibtex, blitzbasic, bnf, boo, c, c_mac, caddcl, cadlisp, cfdg, cfm, cil, cmake, cobol, cpp-qt, cpp, csharp, css, d, dcs, delphi, diff, div, dos, dot, eiffel, email, erlang, fo, fortran, freebasic, genero, gettext, glsl, gml, gnuplot, groovy, haskell, hq9plus, html4strict, idl, ini, inno, intercal, io, java, java5, javascript, kixtart, klonec, klonecpp, latex, lisp, locobasic, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, make, matlab, mirc, modula3, mpasm, mxml, mysql, nsis, oberon2, objc, ocaml-brief, ocaml, oobas, oracle11, oracle8, pascal, per, perl, php-brief, php, pic16, pixelbender, plsql, povray, powershell, progress, prolog, properties, providex, python, qbasic, rails, rebol, reg, robots, ruby, sas, scala, scheme, scilab, sdlbasic, smalltalk, smarty, sql, tcl, teraterm, text, thinbasic, tsql, typoscript, vb, vbnet, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xml, xorg_conf, xpp, yaml, z80.</p>
<blockquote><p><strong>CodeColorer 插件下载地址：</strong><br />
1、<a title="CodeColorer 官方下载" href="http://kpumuk.info/projects/wordpress-plugins/codecolorer/" target="_blank">http://kpumuk.info/projects/wordpress-plugins/codecolorer/<br />
</a>2、<a title="CodeColorer WordPress 插件库下载" href="http://wordpress.org/extend/plugins/codecolorer/" target="_blank">http://wordpress.org/extend/plugins/codecolorer/</a>
</p></blockquote>
<p>Ps.开始想把 CodeColorer 提取出来，不安插件，直接调用里面的 Js、Css 文件，没想到要调用的太多了，而且效果不是很好，作罢！</p>
<h3  class="related_post_title"><I><B>相关日志</B></I></h3><ul class="related_post"><li><a rel="bookmark" href="http://haozer.com/disable-autosave-wp-defense-spam.html" title="分享WordPress禁用自动保存以及防Spam技巧">分享WordPress禁用自动保存以及防Spam技巧</a> (24)</li><li><a rel="bookmark" href="http://haozer.com/permalink-redirect.html" title="更改固定链接样式">更改固定链接样式</a> (70)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-wp_title.html" title="WordPress wp_title 模版标签">WordPress wp_title 模版标签</a> (111)</li><li><a rel="bookmark" href="http://haozer.com/jquery-buttoncaptcha.html" title="非常实用的 jQuery 验证码">非常实用的 jQuery 验证码</a> (73)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-random-button.html" title="WordPress 随机文章按钮">WordPress 随机文章按钮</a> (33)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-related-posts-code.html" title="两种实现 WordPress 相关日志代码">两种实现 WordPress 相关日志代码</a> (23)</li></ul><div style="margin: 0;">
				<script type="text/javascript"><!--
				google_ad_client = "ca-pub-4651455768821115";
				/* 336x280, 创建于 10-6-4 */
				google_ad_slot = "3240066453";
				google_ad_width = 336;
				google_ad_height = 280;
				//-->
				</script>
				<script type="text/javascript"
				src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
				</script>
				</div><div>
				<b><a href="http://feed.haozer.com" target="_blank" title="订阅 浩子 Feed">订阅浩子</a>：</b>
				<a rel="nofollow" target="_blank" href="http://reader.youdao.com/b.do?url=http://feed.haozer.com">有道</a>, 
				<a rel="nofollow" target="_blank" href="http://www.xianguo.com/subscribe.php?url=http://feed.haozer.com">鲜果</a>, 
				<a rel="nofollow" target="_blank" href="http://www.zhuaxia.com/add_channel.php?url=httP://feed.haozer.com">抓虾</a>, 
				<a rel="nofollow" target="_blank" href="http://inezha.com/add?url=http://feed.haozer.com/">哪吒</a>, 
				<a rel="nofollow" target="_blank" href="http://9.douban.com/reader/subscribe?url=http://feed.haozer.com">九点</a>, 
				<a rel="nofollow" target="_blank" href="http://mail.qq.com/cgi-bin/feed?u=http://feed.haozer.com">QQ邮箱</a>, 
				<a rel="nofollow" target="_blank" href="https://www.google.com/reader/view/feed/http://feed.haozer.com">Google</a>, 
				<a rel="nofollow" target="_blank" href="http://list.qq.com/cgi-bin/qf_invite?id=01d504b1f6e8f1ba7c8a5467797220449af8087f4200d8e7">邮件订阅</a>
				</div>]]></content:encoded>
			<wfw:commentRss>http://haozer.com/wordpress-plugins-codecolorer.html/feed</wfw:commentRss>
		<slash:comments>59</slash:comments>
		</item>
		<item>
		<title>非常实用的 jQuery 验证码</title>
		<link>http://haozer.com/jquery-buttoncaptcha.html</link>
		<comments>http://haozer.com/jquery-buttoncaptcha.html#comments</comments>
		<pubDate>Mon, 02 May 2011 09:07:46 +0000</pubDate>
		<dc:creator>浩子</dc:creator>
				<category><![CDATA[分享|Share]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://haozer.com/?p=184</guid>
		<description><![CDATA[一直以来，WordPress Spam 问题愈来愈严重，即使有必装的 Akismet 插件，每个 WPer 还是会收到人或着 Robot 发的各式各样的垃圾广告。有人会安装各式的验证码插件来屏蔽垃圾，但我不喜欢插件，以前 WordPress 可以加点 算术代码 来防 Spam，现在版本升级越来越快，此方法早已行不通。 今天我向大家推荐的这款 jQuery 验证码，不仅仅 WordPress 可用，折腾折腾只要需要验证码的地方都可以安放。比如 WordPress 这样使用： 1、下载：jQuery.buttonCaptcha； 2、保存 jquery.buttonCaptcha.js，jquery.buttonCaptcha.styles.css 和 'images' 文件夹到 WordPress 主题某一路径下。记住，所有关于 buttonCaptcha 文件必须保存在同一目录，如果没有那么你就需要编辑 .css 文件； 3、将下面代码放到 &#60;body&#62; 里面： /*如果没有 jQuery 文件请自行到官网下载*/ &#60;script type=&#34;text/javascript&#34; src=&#34;&#60;?php bloginfo('template_url'); ?&#62;/js/jquery-1.5.1.min.js&#34;&#62;&#60;/script&#62; &#60;script type=&#34;text/javascript&#34; src=&#34;&#60;?php bloginfo('template_url'); ?&#62;/js/jquery-ui-1.8.12.custom.min.js&#34;&#62;&#60;/script&#62; &#60;link rel=&#34;stylesheet&#34; type=&#34;text/css&#34; href=&#34;&#60;?php bloginfo('template_url'); ?&#62;/js/buttonCaptcha/jquery.buttonCaptcha.styles.css&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>一直以来，WordPress Spam 问题愈来愈严重，即使有必装的 Akismet 插件，每个 WPer 还是会收到人或着 Robot 发的各式各样的垃圾广告。有人会安装各式的验证码插件来屏蔽垃圾，但我不喜欢插件，以前 WordPress 可以加点 <a href="http://haozer.com/disable-autosave-wp-defense-spam.html" target="_blank">算术代码</a> 来防 Spam，现在版本升级越来越快，此方法早已行不通。<span id="more-184"></span></p>
<p>今天我向大家推荐的这款 jQuery 验证码，不仅仅 WordPress 可用，折腾折腾只要需要验证码的地方都可以安放。比如 WordPress 这样使用：<br />
1、下载：<a href="http://www.gobwas.com/bcaptcha#download" target="_blank">jQuery.buttonCaptcha</a>；<br />
2、保存 jquery.buttonCaptcha.js，jquery.buttonCaptcha.styles.css 和 'images' 文件夹到  WordPress 主题某一路径下。记住，所有关于 buttonCaptcha 文件必须保存在同一目录，如果没有那么你就需要编辑 .css 文件；<br />
3、将下面代码放到 &lt;body&gt; 里面：</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:95%;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/*如果没有 jQuery 文件请自行到官网下载*/<br />
&lt;script type=&quot;text/javascript&quot; src=&quot;&lt;?php bloginfo('template_url'); ?&gt;/js/jquery-1.5.1.min.js&quot;&gt;&lt;/script&gt;<br />
&lt;script type=&quot;text/javascript&quot; src=&quot;&lt;?php bloginfo('template_url'); ?&gt;/js/jquery-ui-1.8.12.custom.min.js&quot;&gt;&lt;/script&gt;<br />
&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;&lt;?php bloginfo('template_url'); ?&gt;/js/buttonCaptcha/jquery.buttonCaptcha.styles.css&quot; /&gt;<br />
&lt;script type=&quot;text/javascript&quot; src=&quot;&lt;?php bloginfo('template_url'); ?&gt;/js/buttonCaptcha/jquery.buttonCaptcha.min.js&quot;&gt;&lt;/script&gt;<br />
/*具体设置显示参数可以参考 jquery.buttonCaptcha.js 文件*/<br />
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#submit&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">buttonCaptcha</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">//#submit请修改为你评论提交按钮的ID</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; codeWord<span style="color: #339933;">:</span><span style="color: #3366CC;">'H'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; codeZone<span style="color: #339933;">:</span><span style="color: #3366CC;">'aozer'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; captchaHeader<span style="color: #339933;">:</span><span style="color: #3366CC;">'你是 Robot 吗？// Are you a robot?'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; captchaTip<span style="color: #339933;">:</span><span style="color: #3366CC;">'拖动左边的字母到右边，直到出现 &quot;%code_word%&quot;。谢谢！&lt;br&gt;Drag letters from left to right, to get word &quot;H&quot;. Thanks!'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; captchaUnlocked<span style="color: #339933;">:</span><span style="color: #3366CC;">'已解锁！// Unlocked!'</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></div></div>
<p>就这样，具体演示就看文章后面评论下面的验证码吧，再改改还可以用到其它地方哦！本验证码出自：<a href="http://www.gobwas.com/bcaptcha" target="_blank">buttonCaptcha</a></p>
<h3  class="related_post_title"><I><B>相关日志</B></I></h3><ul class="related_post"><li><a rel="bookmark" href="http://haozer.com/permalink-redirect.html" title="更改固定链接样式">更改固定链接样式</a> (70)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-wp_title.html" title="WordPress wp_title 模版标签">WordPress wp_title 模版标签</a> (111)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-plugins-codecolorer.html" title="WordPress 插件 CodeColorer">WordPress 插件 CodeColorer</a> (59)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-random-button.html" title="WordPress 随机文章按钮">WordPress 随机文章按钮</a> (33)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-related-posts-code.html" title="两种实现 WordPress 相关日志代码">两种实现 WordPress 相关日志代码</a> (23)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-email-form-code.html" title="用代码实现 WordPress 邮件表单">用代码实现 WordPress 邮件表单</a> (23)</li></ul><div style="margin: 0;">
				<script type="text/javascript"><!--
				google_ad_client = "ca-pub-4651455768821115";
				/* 336x280, 创建于 10-6-4 */
				google_ad_slot = "3240066453";
				google_ad_width = 336;
				google_ad_height = 280;
				//-->
				</script>
				<script type="text/javascript"
				src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
				</script>
				</div><div>
				<b><a href="http://feed.haozer.com" target="_blank" title="订阅 浩子 Feed">订阅浩子</a>：</b>
				<a rel="nofollow" target="_blank" href="http://reader.youdao.com/b.do?url=http://feed.haozer.com">有道</a>, 
				<a rel="nofollow" target="_blank" href="http://www.xianguo.com/subscribe.php?url=http://feed.haozer.com">鲜果</a>, 
				<a rel="nofollow" target="_blank" href="http://www.zhuaxia.com/add_channel.php?url=httP://feed.haozer.com">抓虾</a>, 
				<a rel="nofollow" target="_blank" href="http://inezha.com/add?url=http://feed.haozer.com/">哪吒</a>, 
				<a rel="nofollow" target="_blank" href="http://9.douban.com/reader/subscribe?url=http://feed.haozer.com">九点</a>, 
				<a rel="nofollow" target="_blank" href="http://mail.qq.com/cgi-bin/feed?u=http://feed.haozer.com">QQ邮箱</a>, 
				<a rel="nofollow" target="_blank" href="https://www.google.com/reader/view/feed/http://feed.haozer.com">Google</a>, 
				<a rel="nofollow" target="_blank" href="http://list.qq.com/cgi-bin/qf_invite?id=01d504b1f6e8f1ba7c8a5467797220449af8087f4200d8e7">邮件订阅</a>
				</div>]]></content:encoded>
			<wfw:commentRss>http://haozer.com/jquery-buttoncaptcha.html/feed</wfw:commentRss>
		<slash:comments>73</slash:comments>
		</item>
		<item>
		<title>WordPress 随机文章按钮</title>
		<link>http://haozer.com/wordpress-random-button.html</link>
		<comments>http://haozer.com/wordpress-random-button.html#comments</comments>
		<pubDate>Sat, 23 Apr 2011 09:00:30 +0000</pubDate>
		<dc:creator>浩子</dc:creator>
				<category><![CDATA[分享|Share]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://haozer.com/?p=183</guid>
		<description><![CDATA[谷歌首页的“手气不错”按钮很是不错，好多 WordPress 的站点也弄有随机文章的按钮。Google、Baidu下大家分享的按钮代码都会显示出随机文章的链接，这可没有带来“随机”的神秘感，试想别人根据链接地址随机的文章不喜欢怎么办，我要的效果是：只显示 /?random 这样永远不知道下一次点击你会穿越到那篇文章，嘿嘿，有木有神秘感！ WordPress 随机文章按钮（推荐） 使用 Random Redirect 插件，Description:Allows you to create a link to yourblog.example.com/?random which will redirect someone to a random post on your blog, in a StumbleUpon-like fashion. 因此你可以安装此插件后建立个链接就好，或者像我不太喜欢安装太多插件的话，就将下面代码扔到主题 functions.php 文件，再建立链接就OK！ /* 随机阅读浏览 */ function matt_random_redirect&#40;&#41; &#123; &#160; &#160; global $wpdb; &#160; &#160; &#160; &#160; $query = &#34;SELECT ID FROM [...]]]></description>
			<content:encoded><![CDATA[<p>谷歌首页的“手气不错”按钮很是不错，好多 WordPress 的站点也弄有随机文章的按钮。Google、Baidu下大家分享的按钮代码都会显示出随机文章的链接，这可没有带来“随机”的神秘感，试想别人根据链接地址随机的文章不喜欢怎么办，我要的效果是：只显示 /?random 这样永远不知道下一次点击你会穿越到那篇文章，嘿嘿，有木有神秘感！<span id="more-183"></span></p>
<p><strong>WordPress 随机文章按钮（推荐）</strong><br />
使用 <a href="http://wordpress.org/extend/plugins/random-redirect/" target="_blank">Random Redirect</a> 插件，Description:Allows you to create a link to yourblog.example.com/?random which will  redirect someone to a random post on your blog, in a StumbleUpon-like  fashion. 因此你可以安装此插件后建立个链接就好，或者像我不太喜欢安装太多插件的话，就将下面代码扔到主题 functions.php 文件，再建立链接就OK！</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:95%;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">/* 随机阅读浏览 */</span><br />
<span style="color: #000000; font-weight: bold;">function</span> matt_random_redirect<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT ID FROM <span style="color: #006699; font-weight: bold;">$wpdb-&gt;posts</span> WHERE post_type = 'post' AND post_password = '' AND &nbsp; post_status = 'publish' ORDER BY RAND() LIMIT 1&quot;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'random_cat_id'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$random_cat_id</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'random_cat_id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT DISTINCT ID FROM <span style="color: #006699; font-weight: bold;">$wpdb-&gt;posts</span> AS p INNER JOIN <span style="color: #006699; font-weight: bold;">$wpdb-&gt;term_relationships</span> AS tr ON (p.ID = tr.object_id AND tr.term_taxonomy_id = <span style="color: #006699; font-weight: bold;">$random_cat_id</span>) INNER JOIN &nbsp;<span style="color: #006699; font-weight: bold;">$wpdb-&gt;term_taxonomy</span> AS tt ON(tr.term_taxonomy_id = tt.term_taxonomy_id AND taxonomy = 'category') WHERE post_type = 'post' AND post_password = '' AND &nbsp; &nbsp; post_status = 'publish' ORDER BY RAND() LIMIT 1&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'random_post_type'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$post_type</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'|[^a-z]|i'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'random_post_type'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT ID FROM <span style="color: #006699; font-weight: bold;">$wpdb-&gt;posts</span> WHERE post_type = '<span style="color: #006699; font-weight: bold;">$post_type</span>' AND post_password = '' AND &nbsp; &nbsp; post_status = 'publish' ORDER BY RAND() LIMIT 1&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000088;">$random_id</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_var</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$query</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; wp_redirect<span style="color: #009900;">&#40;</span> get_permalink<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$random_id</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #990000;">exit</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'random'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'template_redirect'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'matt_random_redirect'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p><strong>WordPress 随机文章代码（带有链接地址）</strong><br />
使用 WordPress 默认函数 get_posts 中的 orderby=rand 属性来随机选取文章链接。</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:95%;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000088;">$rand_post</span><span style="color: #339933;">=</span>get_posts<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'numberposts=1&amp;orderby=rand'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$rand_post</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;随机&lt;/a&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endforeach</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></div></div>
<p><strong>WordPress 调用多篇随机文章代码</strong><br />
随机选择 10 篇文章，列表样式可以根据需要自定义。</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:95%;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000088;">$rand_post</span> <span style="color: #339933;">=</span> get_posts<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'numberposts=10&amp;orderby=rand'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$rand_post</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$post</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><br />
&lt;li&gt;&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; title=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;&lt;/li&gt;<br />
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endforeach</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></div></div>
<h3  class="related_post_title"><I><B>相关日志</B></I></h3><ul class="related_post"><li><a rel="bookmark" href="http://haozer.com/permalink-redirect.html" title="更改固定链接样式">更改固定链接样式</a> (70)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-wp_title.html" title="WordPress wp_title 模版标签">WordPress wp_title 模版标签</a> (111)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-plugins-codecolorer.html" title="WordPress 插件 CodeColorer">WordPress 插件 CodeColorer</a> (59)</li><li><a rel="bookmark" href="http://haozer.com/jquery-buttoncaptcha.html" title="非常实用的 jQuery 验证码">非常实用的 jQuery 验证码</a> (73)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-related-posts-code.html" title="两种实现 WordPress 相关日志代码">两种实现 WordPress 相关日志代码</a> (23)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-email-form-code.html" title="用代码实现 WordPress 邮件表单">用代码实现 WordPress 邮件表单</a> (23)</li></ul><div style="margin: 0;">
				<script type="text/javascript"><!--
				google_ad_client = "ca-pub-4651455768821115";
				/* 336x280, 创建于 10-6-4 */
				google_ad_slot = "3240066453";
				google_ad_width = 336;
				google_ad_height = 280;
				//-->
				</script>
				<script type="text/javascript"
				src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
				</script>
				</div><div>
				<b><a href="http://feed.haozer.com" target="_blank" title="订阅 浩子 Feed">订阅浩子</a>：</b>
				<a rel="nofollow" target="_blank" href="http://reader.youdao.com/b.do?url=http://feed.haozer.com">有道</a>, 
				<a rel="nofollow" target="_blank" href="http://www.xianguo.com/subscribe.php?url=http://feed.haozer.com">鲜果</a>, 
				<a rel="nofollow" target="_blank" href="http://www.zhuaxia.com/add_channel.php?url=httP://feed.haozer.com">抓虾</a>, 
				<a rel="nofollow" target="_blank" href="http://inezha.com/add?url=http://feed.haozer.com/">哪吒</a>, 
				<a rel="nofollow" target="_blank" href="http://9.douban.com/reader/subscribe?url=http://feed.haozer.com">九点</a>, 
				<a rel="nofollow" target="_blank" href="http://mail.qq.com/cgi-bin/feed?u=http://feed.haozer.com">QQ邮箱</a>, 
				<a rel="nofollow" target="_blank" href="https://www.google.com/reader/view/feed/http://feed.haozer.com">Google</a>, 
				<a rel="nofollow" target="_blank" href="http://list.qq.com/cgi-bin/qf_invite?id=01d504b1f6e8f1ba7c8a5467797220449af8087f4200d8e7">邮件订阅</a>
				</div>]]></content:encoded>
			<wfw:commentRss>http://haozer.com/wordpress-random-button.html/feed</wfw:commentRss>
		<slash:comments>33</slash:comments>
		</item>
		<item>
		<title>两种实现 WordPress 相关日志代码</title>
		<link>http://haozer.com/wordpress-related-posts-code.html</link>
		<comments>http://haozer.com/wordpress-related-posts-code.html#comments</comments>
		<pubDate>Wed, 17 Nov 2010 03:18:59 +0000</pubDate>
		<dc:creator>浩子</dc:creator>
				<category><![CDATA[分享|Share]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://haozer.com/?p=177</guid>
		<description><![CDATA[曾经几何为了这个相关日志弄的我头的大了，如果说安装插件当然很容易就能实现，但是如果用代码来实现 WordPress 相关日志呢？网上也有很多的版本，什么文章关键词匹配、分类匹配、查询数据库的方式……插件和代码方式不外乎都是这几种方式来实现，对插件以及代码的使用后个人觉得还是代码方便，不想折腾的就安装插件吧。以下就分享下收集的代码版。 一、提取 WordPress Related Posts 插件代码（推荐） 此方法来自 Hacklog 可以去他那下载文件直接调用或者直接在主题 functions.php 文件中添加如下代码： /* 相关日志 */ &#160; &#160;$wp_rp=array&#40; &#160; &#160; 'limit'=&#62;6, //显示几条相关文章 &#160; &#160; 'wp_rp_rss'=&#62;true, //在rss feed 中显示相关文章 &#160; &#160; 'wp_no_rp'=&#62;'random', //无相关文章时的选择：text 或random （random为显示随机文章) &#160; &#160; 'wp_rp_date'=&#62;false, //显示日志发布日期 &#160; &#160; 'wp_rp_comments'=&#62;true, //显示日志评论数 &#160; &#160; 'wp_rp_title_tag'=&#62;'h3',//相关日志标题标签(h2 ,h3 ,h4 ,p ,div) &#160; &#160; &#41;; function wp_get_random_posts &#40;$limitclause=&#34;&#34;&#41; [...]]]></description>
			<content:encoded><![CDATA[<p>曾经几何为了这个相关日志弄的我头的大了，如果说安装插件当然很容易就能实现，但是如果用代码来实现 WordPress 相关日志呢？网上也有很多的版本，什么文章关键词匹配、分类匹配、查询数据库的方式……插件和代码方式不外乎都是这几种方式来实现，对插件以及代码的使用后个人觉得还是代码方便，不想折腾的就安装插件吧。以下就分享下收集的代码版。<span id="more-177"></span></p>
<p><strong>一、提取 WordPress Related Posts 插件代码</strong>（推荐）<br />
此方法来自 <a href="http://www.ihacklog.com/wordpress/wpskills/wordpress-related-posts-with-no-plugin.html" target="_blank">Hacklog</a> 可以去他那下载文件直接调用或者直接在主题 functions.php 文件中添加如下代码：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:95%;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">/* 相关日志 */</span><br />
&nbsp; &nbsp;<span style="color: #000088;">$wp_rp</span><span style="color: #339933;">=</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'limit'</span><span style="color: #339933;">=&gt;</span><span style="color: #cc66cc;">6</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">//显示几条相关文章</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'wp_rp_rss'</span><span style="color: #339933;">=&gt;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">//在rss feed 中显示相关文章</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'wp_no_rp'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'random'</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">//无相关文章时的选择：text 或random （random为显示随机文章)</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'wp_rp_date'</span><span style="color: #339933;">=&gt;</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">//显示日志发布日期</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'wp_rp_comments'</span><span style="color: #339933;">=&gt;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">//显示日志评论数</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'wp_rp_title_tag'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'h3'</span><span style="color: #339933;">,</span><span style="color: #666666; font-style: italic;">//相关日志标题标签(h2 ,h3 ,h4 ,p ,div)</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">function</span> wp_get_random_posts <span style="color: #009900;">&#40;</span><span style="color: #000088;">$limitclause</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; <span style="color: #000088;">$q</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT ID, post_title, post_content,post_excerpt, post_date, comment_count FROM <span style="color: #006699; font-weight: bold;">$wpdb-&gt;posts</span> WHERE post_status = 'publish' AND post_type = 'post' AND ID != <span style="color: #006699; font-weight: bold;">$post-&gt;ID</span> ORDER BY RAND() <span style="color: #006699; font-weight: bold;">$limitclause</span>&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_results</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$q</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> wp_get_related_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span> &nbsp;<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post</span><span style="color: #339933;">,</span><span style="color: #000088;">$wp_rp</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$limit</span> <span style="color: #339933;">=</span><span style="color: #000088;">$wp_rp</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;limit&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$wp_rp_title</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'&lt;I&gt;&lt;B&gt;相关日志&lt;/B&gt;&lt;/I&gt;'</span><span style="color: #339933;">;</span> &nbsp;<br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #b1b100;">return</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$now</span> <span style="color: #339933;">=</span> current_time<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'mysql'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$tags</span> <span style="color: #339933;">=</span> wp_get_post_tags<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<br />
&nbsp; &nbsp; <span style="color: #000088;">$taglist</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;'&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$tags</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">term_id</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;'&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<br />
&nbsp; &nbsp; <span style="color: #000088;">$tagcount</span> <span style="color: #339933;">=</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tags</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$tagcount</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">&lt;</span> <span style="color: #000088;">$tagcount</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$taglist</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$taglist</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;, '&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$tags</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">term_id</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;'&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp;<br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$limit</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$limitclause</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;LIMIT <span style="color: #006699; font-weight: bold;">$limit</span>&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span> &nbsp; <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$limitclause</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;LIMIT 10&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp;<br />
&nbsp; &nbsp; <span style="color: #000088;">$q</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT p.ID, p.post_title, p.post_content,p.post_excerpt, p.post_date, &nbsp;p.comment_count, count(t_r.object_id) as cnt FROM <span style="color: #006699; font-weight: bold;">$wpdb-&gt;term_taxonomy</span> t_t, <span style="color: #006699; font-weight: bold;">$wpdb-&gt;term_relationships</span> t_r, <span style="color: #006699; font-weight: bold;">$wpdb-&gt;posts</span> p WHERE t_t.taxonomy ='post_tag' AND t_t.term_taxonomy_id = t_r.term_taxonomy_id AND t_r.object_id &nbsp;= p.ID AND (t_t.term_id IN (<span style="color: #006699; font-weight: bold;">$taglist</span>)) AND p.ID != <span style="color: #006699; font-weight: bold;">$post-&gt;ID</span> AND p.post_status = 'publish' AND p.post_date_gmt &lt; '<span style="color: #006699; font-weight: bold;">$now</span>' GROUP BY t_r.object_id ORDER BY cnt DESC, p.post_date_gmt DESC <span style="color: #006699; font-weight: bold;">$limitclause</span>;&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<br />
&nbsp; &nbsp; <span style="color: #000088;">$related_posts</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_results</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$q</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<br />
&nbsp; &nbsp; <span style="color: #000088;">$output</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//不存在相关日志则显示随机日志</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$related_posts</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$wp_rp</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'wp_no_rp'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;text&quot;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$output</span> &nbsp;<span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;li&gt;无相关日志&lt;/li&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$wp_rp</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'wp_no_rp'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;random&quot;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$wp_no_rp_text</span><span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;I&gt;&lt;B&gt;随机日志&lt;/B&gt;&lt;/I&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$related_posts</span> <span style="color: #339933;">=</span> wp_get_random_posts<span style="color: #009900;">&#40;</span><span style="color: #000088;">$limitclause</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> &nbsp;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$wp_rp_title</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wp_no_rp_text</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp;<br />
&nbsp; &nbsp; <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$related_posts</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$related_post</span> <span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;li&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$wp_rp</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'wp_rp_date'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$dateformat</span> <span style="color: #339933;">=</span> get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'date_format'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> mysql2date<span style="color: #009900;">&#40;</span><span style="color: #000088;">$dateformat</span><span style="color: #339933;">,</span> <span style="color: #000088;">$related_post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_date</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot; &nbsp;// &nbsp;&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> &nbsp;<span style="color: #0000ff;">'&lt;a rel=&quot;bookmark&quot; href=&quot;'</span><span style="color: #339933;">.</span>get_permalink<span style="color: #009900;">&#40;</span><span style="color: #000088;">$related_post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; title=&quot;'</span><span style="color: #339933;">.</span>wptexturize<span style="color: #009900;">&#40;</span><span style="color: #000088;">$related_post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_title</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;'</span><span style="color: #339933;">.</span>wptexturize<span style="color: #009900;">&#40;</span><span style="color: #000088;">$related_post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_title</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/a&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$wp_rp</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;wp_rp_comments&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> &nbsp;<span style="color: #0000ff;">&quot; (&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$related_post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">comment_count</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;)&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> &nbsp;<span style="color: #0000ff;">'&lt;/li&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$output</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;ul class=&quot;related_post&quot;&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$output</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/ul&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$wp_rp_title_tag</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wp_rp</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;wp_rp_title_tag&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$wp_rp_title_tag</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$wp_rp_title_tag</span> <span style="color: #339933;">=</span><span style="color: #0000ff;">'h3'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$wp_rp_title</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$output</span> <span style="color: #339933;">=</span> &nbsp;<span style="color: #0000ff;">'&lt;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$wp_rp_title_tag</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' &nbsp;class=&quot;related_post_title&quot;&gt;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$wp_rp_title</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/'</span><span style="color: #339933;">.</span><span style="color: #000088;">$wp_rp_title_tag</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&gt;'</span><span style="color: #339933;">.</span> <span style="color: #000088;">$output</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$output</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp;<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> wp_related_posts_attach<span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wp_rp</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>is_single<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">||</span><span style="color: #009900;">&#40;</span>is_feed<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$wp_rp</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;wp_rp_rss&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$output</span> <span style="color: #339933;">=</span> wp_get_related_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$content</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$output</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp;<br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$content</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'the_content'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wp_related_posts_attach'</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">100</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>之所以推荐此代码，因为它直接提取 WordPress Related Posts 插件核心代码，取其精髓而且能达到定制的功能，具体参见代码头部的设置选项。</p>
<p><strong>二、网上搜罗的修改代码</strong>（据说出自Willin Kan）<br />
直接将如下代码贴进主题 functions.php 文件中：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:95%;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;h3&gt;相關文章:&lt;/h3&gt;<br />
&lt;ul&gt;<br />
<span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<span style="color: #000088;">$post_num</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// 數量設定.</span><br />
<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$post</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$tmp_post</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$post</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$tags</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// 先取 tags 文章.</span><br />
<span style="color: #000088;">$exclude_id</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$posttags</span> <span style="color: #339933;">=</span> get_the_tags<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$posttags</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$posttags</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$tag</span> <span style="color: #009900;">&#41;</span> <span style="color: #000088;">$tags</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$tag</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">','</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #000088;">$tags</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strtr</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">rtrim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tags</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">','</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'-'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #000088;">$myposts</span> <span style="color: #339933;">=</span> get_posts<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'numberposts='</span><span style="color: #339933;">.</span><span style="color: #000088;">$post_num</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&amp;tag='</span><span style="color: #339933;">.</span><span style="color: #000088;">$tags</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&amp;exclude='</span><span style="color: #339933;">.</span><span style="color: #000088;">$exclude_id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$myposts</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; setup_postdata<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">?&gt;</span><br />
&nbsp; &nbsp; &lt;li&gt;&amp;#9829; &lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt; (<span style="color: #000000; font-weight: bold;">&lt;?php</span> comments_number<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>)&lt;/li&gt;<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$exclude_id</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">','</span><span style="color: #339933;">.</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">++;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">&lt;</span> <span style="color: #000088;">$post_num</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// 當 tags 文章數量不足, 再取 category 補足.</span><br />
&nbsp; <span style="color: #000088;">$post</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$tmp_post</span><span style="color: #339933;">;</span> setup_postdata<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #000088;">$cats</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span> <span style="color: #000088;">$post_num</span> <span style="color: #339933;">-=</span> <span style="color: #000088;">$i</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span> get_the_category<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$cat</span> <span style="color: #009900;">&#41;</span> <span style="color: #000088;">$cats</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$cat</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cat_ID</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">','</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #000088;">$cats</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strtr</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">rtrim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cats</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">','</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'-'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #000088;">$myposts</span> <span style="color: #339933;">=</span> get_posts<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'numberposts='</span><span style="color: #339933;">.</span><span style="color: #000088;">$post_num</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&amp;category='</span><span style="color: #339933;">.</span><span style="color: #000088;">$cats</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&amp;exclude='</span><span style="color: #339933;">.</span><span style="color: #000088;">$exclude_id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$myposts</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; setup_postdata<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">?&gt;</span><br />
&nbsp; &nbsp; &lt;li&gt;&amp;#9829; &lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt; (<span style="color: #000000; font-weight: bold;">&lt;?php</span> comments_number<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>)&lt;/li&gt;<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$i</span> <span style="color: #339933;">++;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;li&gt;尚無相關文章&lt;/li&gt;'</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$post</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$tmp_post</span><span style="color: #339933;">;</span> setup_postdata<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">?&gt;</span><br />
&lt;/ul&gt;</div></div>
<p>当哪儿需要使用相关日志的时候，调用：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:95%;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'RelatedPosts'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>RelatedPosts<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></div></div>
<p>这种代码亦可设置显示多少相关日志以及设置显示输出的格式，但是相比我还是推荐第一种，因为第二种方法我试验后相关日志不够就会调用原文来充当相关日志，会出现重复；而使用第一种是不会出现这种情况的，而且相关日志不足不会重复显示原文，没有相关日志的时候可以自定义显示随机文章或者没有相关日志的文字，甚至自己折腾显示其他东东。</p>
<h3  class="related_post_title"><I><B>相关日志</B></I></h3><ul class="related_post"><li><a rel="bookmark" href="http://haozer.com/permalink-redirect.html" title="更改固定链接样式">更改固定链接样式</a> (70)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-wp_title.html" title="WordPress wp_title 模版标签">WordPress wp_title 模版标签</a> (111)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-plugins-codecolorer.html" title="WordPress 插件 CodeColorer">WordPress 插件 CodeColorer</a> (59)</li><li><a rel="bookmark" href="http://haozer.com/jquery-buttoncaptcha.html" title="非常实用的 jQuery 验证码">非常实用的 jQuery 验证码</a> (73)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-random-button.html" title="WordPress 随机文章按钮">WordPress 随机文章按钮</a> (33)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-email-form-code.html" title="用代码实现 WordPress 邮件表单">用代码实现 WordPress 邮件表单</a> (23)</li></ul><div style="margin: 0;">
				<script type="text/javascript"><!--
				google_ad_client = "ca-pub-4651455768821115";
				/* 336x280, 创建于 10-6-4 */
				google_ad_slot = "3240066453";
				google_ad_width = 336;
				google_ad_height = 280;
				//-->
				</script>
				<script type="text/javascript"
				src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
				</script>
				</div><div>
				<b><a href="http://feed.haozer.com" target="_blank" title="订阅 浩子 Feed">订阅浩子</a>：</b>
				<a rel="nofollow" target="_blank" href="http://reader.youdao.com/b.do?url=http://feed.haozer.com">有道</a>, 
				<a rel="nofollow" target="_blank" href="http://www.xianguo.com/subscribe.php?url=http://feed.haozer.com">鲜果</a>, 
				<a rel="nofollow" target="_blank" href="http://www.zhuaxia.com/add_channel.php?url=httP://feed.haozer.com">抓虾</a>, 
				<a rel="nofollow" target="_blank" href="http://inezha.com/add?url=http://feed.haozer.com/">哪吒</a>, 
				<a rel="nofollow" target="_blank" href="http://9.douban.com/reader/subscribe?url=http://feed.haozer.com">九点</a>, 
				<a rel="nofollow" target="_blank" href="http://mail.qq.com/cgi-bin/feed?u=http://feed.haozer.com">QQ邮箱</a>, 
				<a rel="nofollow" target="_blank" href="https://www.google.com/reader/view/feed/http://feed.haozer.com">Google</a>, 
				<a rel="nofollow" target="_blank" href="http://list.qq.com/cgi-bin/qf_invite?id=01d504b1f6e8f1ba7c8a5467797220449af8087f4200d8e7">邮件订阅</a>
				</div>]]></content:encoded>
			<wfw:commentRss>http://haozer.com/wordpress-related-posts-code.html/feed</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>用代码实现 WordPress 邮件表单</title>
		<link>http://haozer.com/wordpress-email-form-code.html</link>
		<comments>http://haozer.com/wordpress-email-form-code.html#comments</comments>
		<pubDate>Tue, 05 Oct 2010 05:33:29 +0000</pubDate>
		<dc:creator>浩子</dc:creator>
				<category><![CDATA[分享|Share]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://haozer.com/?p=172</guid>
		<description><![CDATA[在博客2岁了里曾说过浩子部落格添加了邮件发送表单，今天把添加方法贴出来，或许对于有的博主来说会有用吧。添加到邮件联系表单的好处不言而喻，不用再像以前那样建立单独页面然后以评论方式来联系，评论多了就不好处理了而且别人通过邮件联系你可以直接通过邮件回复。当然也有人会选择插件来生成邮件表单~额~这个嘛，因为我个人不想为了一个页面就安装个插件，那不是大材小用么。 注意我介绍的此邮件表单代码只适用于 WordPress 程序，当然你可以参考修改代码使用到其它地方。添加步骤： 1、下载文件包：WordPress 邮件表单，解压将里面的 contact.php、sendemail.php、yz_img.php 放到正在使用的主题文件夹； 2、后台建立一页面，模板选择：联系(Contact)即 contact.php 文件； 3、自己修改美化，测试收工。 本博的效果请参见：关于页面。如果有什么交流的欢迎五湖四海的朋友来信来函~~~ Ps.由于 wordpress 后台贴代码操作不便，原本准备贴出代码来，未遂。请需要的朋友自己下载后研究吧！ 相关日志更改固定链接样式 (70)WordPress wp_title 模版标签 (111)WordPress 插件 CodeColorer (59)非常实用的 jQuery 验证码 (73)WordPress 随机文章按钮 (33)两种实现 WordPress 相关日志代码 (23) 订阅浩子： 有道, 鲜果, 抓虾, 哪吒, 九点, QQ邮箱, Google, 邮件订阅]]></description>
			<content:encoded><![CDATA[<p>在<a href="http://haozer.com/blog-two-years-old.html" target="_blank">博客2岁了</a>里曾说过浩子部落格添加了邮件发送表单，今天把添加方法贴出来，或许对于有的博主来说会有用吧。添加到邮件联系表单的好处不言而喻，不用再像以前那样建立单独页面然后以评论方式来联系，评论多了就不好处理了而且别人通过邮件联系你可以直接通过邮件回复。当然也有人会选择插件来生成邮件表单~额~这个嘛，因为我个人不想为了一个页面就安装个插件，那不是大材小用么。<span id="more-172"></span></p>
<p>注意我介绍的此邮件表单代码只适用于 WordPress 程序，当然你可以参考修改代码使用到其它地方。添加步骤：<br />
1、下载文件包：<a href="http://cid-1e2689e5b1b0f25a.office.live.com/self.aspx/blog/172-worpress-mail-form.zip" target="_blank">WordPress 邮件表单</a>，解压将里面的 contact.php、sendemail.php、yz_img.php 放到正在使用的主题文件夹；<br />
2、后台建立一页面，模板选择：<strong>联系(Contact)</strong>即 contact.php 文件；<br />
3、自己修改美化，测试收工。</p>
<p>本博的效果请参见：<a title="发送邮件联系浩子" href="http://haozer.com/about/" target="_blank">关于</a>页面。如果有什么交流的<strong>欢迎五湖四海的朋友来信来函~~~</strong><br />
Ps.由于 wordpress 后台贴代码操作不便，原本准备贴出代码来，未遂。请需要的朋友自己下载后研究吧！</p>
<h3  class="related_post_title"><I><B>相关日志</B></I></h3><ul class="related_post"><li><a rel="bookmark" href="http://haozer.com/permalink-redirect.html" title="更改固定链接样式">更改固定链接样式</a> (70)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-wp_title.html" title="WordPress wp_title 模版标签">WordPress wp_title 模版标签</a> (111)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-plugins-codecolorer.html" title="WordPress 插件 CodeColorer">WordPress 插件 CodeColorer</a> (59)</li><li><a rel="bookmark" href="http://haozer.com/jquery-buttoncaptcha.html" title="非常实用的 jQuery 验证码">非常实用的 jQuery 验证码</a> (73)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-random-button.html" title="WordPress 随机文章按钮">WordPress 随机文章按钮</a> (33)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-related-posts-code.html" title="两种实现 WordPress 相关日志代码">两种实现 WordPress 相关日志代码</a> (23)</li></ul><div style="margin: 0;">
				<script type="text/javascript"><!--
				google_ad_client = "ca-pub-4651455768821115";
				/* 336x280, 创建于 10-6-4 */
				google_ad_slot = "3240066453";
				google_ad_width = 336;
				google_ad_height = 280;
				//-->
				</script>
				<script type="text/javascript"
				src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
				</script>
				</div><div>
				<b><a href="http://feed.haozer.com" target="_blank" title="订阅 浩子 Feed">订阅浩子</a>：</b>
				<a rel="nofollow" target="_blank" href="http://reader.youdao.com/b.do?url=http://feed.haozer.com">有道</a>, 
				<a rel="nofollow" target="_blank" href="http://www.xianguo.com/subscribe.php?url=http://feed.haozer.com">鲜果</a>, 
				<a rel="nofollow" target="_blank" href="http://www.zhuaxia.com/add_channel.php?url=httP://feed.haozer.com">抓虾</a>, 
				<a rel="nofollow" target="_blank" href="http://inezha.com/add?url=http://feed.haozer.com/">哪吒</a>, 
				<a rel="nofollow" target="_blank" href="http://9.douban.com/reader/subscribe?url=http://feed.haozer.com">九点</a>, 
				<a rel="nofollow" target="_blank" href="http://mail.qq.com/cgi-bin/feed?u=http://feed.haozer.com">QQ邮箱</a>, 
				<a rel="nofollow" target="_blank" href="https://www.google.com/reader/view/feed/http://feed.haozer.com">Google</a>, 
				<a rel="nofollow" target="_blank" href="http://list.qq.com/cgi-bin/qf_invite?id=01d504b1f6e8f1ba7c8a5467797220449af8087f4200d8e7">邮件订阅</a>
				</div>]]></content:encoded>
			<wfw:commentRss>http://haozer.com/wordpress-email-form-code.html/feed</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>博客2岁了</title>
		<link>http://haozer.com/blog-two-years-old.html</link>
		<comments>http://haozer.com/blog-two-years-old.html#comments</comments>
		<pubDate>Mon, 04 Oct 2010 11:39:38 +0000</pubDate>
		<dc:creator>浩子</dc:creator>
				<category><![CDATA[生活|Life]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[博客]]></category>
		<category><![CDATA[纪念]]></category>

		<guid isPermaLink="false">http://haozer.com/?p=171</guid>
		<description><![CDATA[时间过的可真快啊，一晃就2年过去了。自己都觉得难得啊，期间虽说不像有的博主那样轰轰烈烈人气相当旺，也不像有的博主开了几个月就给关闭了……浩子平平淡淡的坚持下来了，翻翻回头的这些日志差不多都是生活的记录，或许就是浩子部落格所描述的那样为了逝去的纪念！ 今天就算是为了纪念写的这篇日志吧，人们过生日都要庆祝下，博客满岁当然也得纪念下了。国庆这些天没怎么出去玩，但不像以前那些国庆长假感觉无聊、无趣、无意义，这段时间发生的事多少思考了点，纠结过、抱怨过、气馁过……想罢国庆后将会是个全新的开始，或许！一定！利用这些天的时间把博客给折腾了下下，用代码加上了邮件发送表单、鼠标悬浮显示 @ 评论、日志分页导航、日志底部加上了文章信息，还有主题其它方面一些小改动。 不用插件实现wordpress邮件表单 参考 PhilNa 修改实现，围观请点击顶部导航栏关于页面。老早就想添加个邮件发送表单来代替留言本，但是一直都苦于不想为了一个页面就安装个插件，网上搜索的代码都不能用，找到 PhilNa 的这篇文章后才开始按照他所说的弄却没给鼓捣成功，作罢。这些天下载了他的主题研究下才给折腾出来，热烈欢迎各位通过此邮件表单联系我。 鼠标悬浮显示 @ 评论 这个没什么好多说的，具体参考 NeoEase 实现，自己再把 css 修改下就搞定，添加此效果一是为了好看，二嘛就是能方便的看到回复的是哪条评论。 另外日志分页导航参考(木木木木木)、日志底部加上了文章信息参考(万戈)分别实现，这些就权当这些天折腾的记录，方便日后查阅！国庆快过一半了，祝各位接下来的节日继续玩的┢┦aΡｐy，顺祝浩子部落格生日快乐！ 相关日志更改固定链接样式 (70)博客一岁了 (67)博客换主题 (47)WordPress wp_title 模版标签 (111)WordPress 插件 CodeColorer (59)非常实用的 jQuery 验证码 (73) 订阅浩子： 有道, 鲜果, 抓虾, 哪吒, 九点, QQ邮箱, Google, 邮件订阅]]></description>
			<content:encoded><![CDATA[<p>时间过的可真快啊，一晃就2年过去了。自己都觉得难得啊，期间虽说不像有的博主那样轰轰烈烈人气相当旺，也不像有的博主开了几个月就给关闭了……浩子平平淡淡的坚持下来了，翻翻回头的这些日志差不多都是生活的记录，或许就是浩子部落格所描述的那样为了逝去的纪念！<span id="more-171"></span></p>
<p>今天就算是为了纪念写的这篇日志吧，人们过生日都要庆祝下，博客满岁当然也得纪念下了。国庆这些天没怎么出去玩，但不像以前那些国庆长假感觉无聊、无趣、无意义，这段时间发生的事多少思考了点，纠结过、抱怨过、气馁过……想罢国庆后将会是个全新的开始，或许！一定！利用这些天的时间把博客给折腾了下下，用代码加上了邮件发送表单、鼠标悬浮显示 @ 评论、日志分页导航、日志底部加上了文章信息，还有主题其它方面一些小改动。</p>
<p><strong>不用插件实现wordpress邮件表单</strong><br />
参考 <a href="http://philna.com/2009/02/set-up-e-mail-form-without-plugin/" target="_blank">PhilNa</a> 修改实现，围观请点击顶部导航栏<strong>关于</strong>页面。老早就想添加个邮件发送表单来代替留言本，但是一直都苦于不想为了一个页面就安装个插件，网上搜索的代码都不能用，找到 PhilNa 的这篇文章后才开始按照他所说的弄却没给鼓捣成功，作罢。这些天下载了他的主题研究下才给折腾出来，热烈欢迎各位通过此邮件表单联系我。</p>
<p><strong>鼠标悬浮显示 @ 评论</strong><br />
这个没什么好多说的，具体参考 <a href="http://www.neoease.com/inove-mouseover-to-show-comment-no/" target="_blank">NeoEase</a> 实现，自己再把 css 修改下就搞定，添加此效果一是为了好看，二嘛就是能方便的看到回复的是哪条评论。</p>
<p>另外<strong>日志分页导航</strong>参考(<a href="http://immmmm.com/wordpress-page-navigation-without-plugins.html" target="_blank">木木木木木</a>)、<strong>日志底部加上了文章信息</strong>参考(<a href="http://wange.im/copyright-in-feed-for-wordpress.html" target="_blank">万戈</a>)分别实现，这些就权当这些天折腾的记录，方便日后查阅！国庆快过一半了，祝各位接下来的节日继续玩的┢┦aΡｐy，顺祝浩子部落格生日快乐！</p>
<h3  class="related_post_title"><I><B>相关日志</B></I></h3><ul class="related_post"><li><a rel="bookmark" href="http://haozer.com/permalink-redirect.html" title="更改固定链接样式">更改固定链接样式</a> (70)</li><li><a rel="bookmark" href="http://haozer.com/blog-one-years-old.html" title="博客一岁了">博客一岁了</a> (67)</li><li><a rel="bookmark" href="http://haozer.com/change-haozer-theme.html" title="博客换主题">博客换主题</a> (47)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-wp_title.html" title="WordPress wp_title 模版标签">WordPress wp_title 模版标签</a> (111)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-plugins-codecolorer.html" title="WordPress 插件 CodeColorer">WordPress 插件 CodeColorer</a> (59)</li><li><a rel="bookmark" href="http://haozer.com/jquery-buttoncaptcha.html" title="非常实用的 jQuery 验证码">非常实用的 jQuery 验证码</a> (73)</li></ul><div style="margin: 0;">
				<script type="text/javascript"><!--
				google_ad_client = "ca-pub-4651455768821115";
				/* 336x280, 创建于 10-6-4 */
				google_ad_slot = "3240066453";
				google_ad_width = 336;
				google_ad_height = 280;
				//-->
				</script>
				<script type="text/javascript"
				src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
				</script>
				</div><div>
				<b><a href="http://feed.haozer.com" target="_blank" title="订阅 浩子 Feed">订阅浩子</a>：</b>
				<a rel="nofollow" target="_blank" href="http://reader.youdao.com/b.do?url=http://feed.haozer.com">有道</a>, 
				<a rel="nofollow" target="_blank" href="http://www.xianguo.com/subscribe.php?url=http://feed.haozer.com">鲜果</a>, 
				<a rel="nofollow" target="_blank" href="http://www.zhuaxia.com/add_channel.php?url=httP://feed.haozer.com">抓虾</a>, 
				<a rel="nofollow" target="_blank" href="http://inezha.com/add?url=http://feed.haozer.com/">哪吒</a>, 
				<a rel="nofollow" target="_blank" href="http://9.douban.com/reader/subscribe?url=http://feed.haozer.com">九点</a>, 
				<a rel="nofollow" target="_blank" href="http://mail.qq.com/cgi-bin/feed?u=http://feed.haozer.com">QQ邮箱</a>, 
				<a rel="nofollow" target="_blank" href="https://www.google.com/reader/view/feed/http://feed.haozer.com">Google</a>, 
				<a rel="nofollow" target="_blank" href="http://list.qq.com/cgi-bin/qf_invite?id=01d504b1f6e8f1ba7c8a5467797220449af8087f4200d8e7">邮件订阅</a>
				</div>]]></content:encoded>
			<wfw:commentRss>http://haozer.com/blog-two-years-old.html/feed</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>用代码实现WordPress Lightbox特效</title>
		<link>http://haozer.com/wordpress-lightbox-code.html</link>
		<comments>http://haozer.com/wordpress-lightbox-code.html#comments</comments>
		<pubDate>Mon, 27 Sep 2010 03:12:22 +0000</pubDate>
		<dc:creator>浩子</dc:creator>
				<category><![CDATA[分享|Share]]></category>
		<category><![CDATA[lightbox]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://haozer.com/?p=168</guid>
		<description><![CDATA[如果你用 WordPress 搭建的是图片博客，那么如何才能让访客面对繁多的图片有个良好的体验呢？或许你会选择插件来展示图片，亦是其它的什么 jQuery 特效。比如：jQuery Lightbox Plugin、Fancybox、Shadowbox、ThickBox、Slightly Thickerbox、Fancy Zoom、Facebox、nyroModal、Interface Imagebox Demo、piroBox、Greybox Redux、prettyPhoto…… 虽然我的博客图片很少（少的可怜⊙﹏⊙b）再者我又不喜欢为了几张图片安装个插件，所以就用代码东拼西凑弄个 LightBox 特效来玩玩，当然觉得安装插件好的童鞋那请自便了。试过网上好多推荐的那些插件，都觉得大材小用了。去看了上面所说的那些效果很炫很漂亮，但还是觉得 Lightbox 很中意，而且相对来说比较小折腾起来也容易。 一、下载：jQuery Lightbox Plugin 解压缩后取其中的：jquery.lightbox-0.5.js、jquery.js、jquery.lightbox-0.5.css、 lightbox-blank.gif、lightbox-ico-loading.gif、lightbox-btn-close.gif、 lightbox-btn-prev.gif、lightbox-btn-next.gif，这些文件归类放到 WordPress 主题文件夹中。 二、加载 jQuery 库（如果网站已有无视这一步骤） 可以选择使用 Google jQuery 库(推荐)： &#60;script type=&#34;text/javascript&#34; src=&#34;http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js&#34;&#62;&#60;/script&#62; 或者使用本身自带的 jQuery 文件： &#60;script type=&#34;text/javascript&#34; src=&#34;&#60;?php bloginfo('template_url'); ?&#62;/js/jquery-1.5.1.min.js&#34;&#62;&#60;/script&#62; 三、添加 Lightbox 文件 在顶部 (header.php)中添加： &#60;link rel=&#34;stylesheet&#34; type=&#34;text/css&#34; href=&#34;&#60;?php bloginfo( 'template_url' ); [...]]]></description>
			<content:encoded><![CDATA[<p>如果你用 WordPress 搭建的是图片博客，那么如何才能让访客面对繁多的图片有个良好的体验呢？或许你会选择插件来展示图片，亦是其它的什么 jQuery 特效。比如：jQuery Lightbox Plugin、Fancybox、Shadowbox、ThickBox、Slightly Thickerbox、Fancy Zoom、Facebox、nyroModal、Interface Imagebox Demo、piroBox、Greybox Redux、prettyPhoto……<span id="more-168"></span></p>
<p>虽然我的博客图片很少（少的可怜⊙﹏⊙b）再者我又不喜欢为了几张图片安装个插件，所以就用代码东拼西凑弄个 LightBox 特效来玩玩，当然觉得安装插件好的童鞋那请自便了。试过网上好多推荐的那些插件，都觉得大材小用了。去看了上面所说的那些效果很炫很漂亮，但还是觉得 Lightbox 很中意，而且相对来说比较小折腾起来也容易。</p>
<p>一、下载：<a href="http://leandrovieira.com/projects/jquery/lightbox/" target="_blank">jQuery Lightbox Plugin</a><br />
解压缩后取其中的：jquery.lightbox-0.5.js、jquery.js、jquery.lightbox-0.5.css、 lightbox-blank.gif、lightbox-ico-loading.gif、lightbox-btn-close.gif、 lightbox-btn-prev.gif、lightbox-btn-next.gif，这些文件归类放到 WordPress 主题文件夹中。</p>
<p>二、加载 jQuery 库（如果网站已有无视这一步骤）<br />
可以选择使用 Google jQuery 库(推荐)：</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:95%;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span> src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span></div></div>
<p>或者使用本身自带的 jQuery 文件：</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:95%;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span> src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;&lt;?php bloginfo('template_url'); ?&gt;/js/jquery-1.5.1.min.js&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span></div></div>
<p>三、添加 Lightbox 文件<br />
在顶部 (header.php)中添加：</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:95%;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;&lt;?php bloginfo( 'template_url' ); ?&gt;/js/jquery.lightbox-0.5.css&quot; media=&quot;screen&quot; /&gt;<br />
&lt;script type=&quot;text/javascript&quot; src=&quot;&lt;?php bloginfo( 'template_url' ); ?&gt;/js/jquery.lightbox-0.5.js&quot;&gt;&lt;/script&gt;<br />
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.post a:has(img)&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">lightBox</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; imageBlank<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;&lt;?php bloginfo( 'template_url' ); ?&gt;/images/lightbox-blank.gif&quot;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; imageLoading<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;&lt;?php bloginfo( 'template_url' ); ?&gt;/images/lightbox-ico-loading.gif&quot;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; imageBtnClose<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;&lt;?php bloginfo( 'template_url' ); ?&gt;/images/lightbox-btn-close.gif&quot;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; imageBtnPrev<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;&lt;?php bloginfo( 'template_url' ); ?&gt;/images/lightbox-btn-prev.gif&quot;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; imageBtnNext<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;&lt;?php bloginfo( 'template_url' ); ?&gt;/images/lightbox-btn-next.gif&quot;</span> &nbsp; &nbsp;<span style="color: #006600; font-style: italic;">//这里注意一定不要再加“ , ”号了在 IE6 下会报错；</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></div></div>
<p>这些文件中的路径随文件位置而参考。<br />
<a href="http://haozer.com/wp-content/uploads/168-labixiaoxin.jpg" target="_blank"><img class="aligncenter" title="蜡笔小新" src="http://haozer.com/wp-content/uploads/168-labixiaoxin.jpg" alt="" width="225" height="167" /></a></p>
<p>OK，如果你点击上面这张图片可以显示而且不是在新窗口打开就说明成功了！<br />
Ps.第一段中的那些有很多炫丽的 jQuery 特效，有空继续用代码折腾看看……</p>
<h3  class="related_post_title"><I><B>相关日志</B></I></h3><ul class="related_post"><li><a rel="bookmark" href="http://haozer.com/permalink-redirect.html" title="更改固定链接样式">更改固定链接样式</a> (70)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-wp_title.html" title="WordPress wp_title 模版标签">WordPress wp_title 模版标签</a> (111)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-plugins-codecolorer.html" title="WordPress 插件 CodeColorer">WordPress 插件 CodeColorer</a> (59)</li><li><a rel="bookmark" href="http://haozer.com/jquery-buttoncaptcha.html" title="非常实用的 jQuery 验证码">非常实用的 jQuery 验证码</a> (73)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-random-button.html" title="WordPress 随机文章按钮">WordPress 随机文章按钮</a> (33)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-related-posts-code.html" title="两种实现 WordPress 相关日志代码">两种实现 WordPress 相关日志代码</a> (23)</li></ul><div style="margin: 0;">
				<script type="text/javascript"><!--
				google_ad_client = "ca-pub-4651455768821115";
				/* 336x280, 创建于 10-6-4 */
				google_ad_slot = "3240066453";
				google_ad_width = 336;
				google_ad_height = 280;
				//-->
				</script>
				<script type="text/javascript"
				src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
				</script>
				</div><div>
				<b><a href="http://feed.haozer.com" target="_blank" title="订阅 浩子 Feed">订阅浩子</a>：</b>
				<a rel="nofollow" target="_blank" href="http://reader.youdao.com/b.do?url=http://feed.haozer.com">有道</a>, 
				<a rel="nofollow" target="_blank" href="http://www.xianguo.com/subscribe.php?url=http://feed.haozer.com">鲜果</a>, 
				<a rel="nofollow" target="_blank" href="http://www.zhuaxia.com/add_channel.php?url=httP://feed.haozer.com">抓虾</a>, 
				<a rel="nofollow" target="_blank" href="http://inezha.com/add?url=http://feed.haozer.com/">哪吒</a>, 
				<a rel="nofollow" target="_blank" href="http://9.douban.com/reader/subscribe?url=http://feed.haozer.com">九点</a>, 
				<a rel="nofollow" target="_blank" href="http://mail.qq.com/cgi-bin/feed?u=http://feed.haozer.com">QQ邮箱</a>, 
				<a rel="nofollow" target="_blank" href="https://www.google.com/reader/view/feed/http://feed.haozer.com">Google</a>, 
				<a rel="nofollow" target="_blank" href="http://list.qq.com/cgi-bin/qf_invite?id=01d504b1f6e8f1ba7c8a5467797220449af8087f4200d8e7">邮件订阅</a>
				</div>]]></content:encoded>
			<wfw:commentRss>http://haozer.com/wordpress-lightbox-code.html/feed</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>WordPress升级到3后的那点破事</title>
		<link>http://haozer.com/upgrade-wordpress-3.html</link>
		<comments>http://haozer.com/upgrade-wordpress-3.html#comments</comments>
		<pubDate>Mon, 16 Aug 2010 10:01:08 +0000</pubDate>
		<dc:creator>浩子</dc:creator>
				<category><![CDATA[杂碎|Mess]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[分享]]></category>
		<category><![CDATA[自动保存]]></category>

		<guid isPermaLink="false">http://haozer.com/?p=164</guid>
		<description><![CDATA[2010年8月14日wordpress中文站“官方”终于更新了，发现后果断从后台升级更新至3.0.1，升级后一下舒坦了觉得心里一块石头放下去了。我偷偷的乐~~~真不是我说的，这CN.WordPress.ORG的速度那真是蜗牛般，差不多都快等到花儿都谢了，瞧！别人用英文版+民间语言包的早就体验上了，囧。 后台升级唯一怕的就是中途断了，如果没有备份数据那就糟了。14号晚上升级的时候我就属于那个如果，不过幸好升级平稳进行，一步到位。前段时间看到wordpress3刚刚发布出来的时候那个默认主题简洁明了！So，接下来就是断断续续的折腾这个TwentyTen主题了，如果盆友们还有什么意见请提出来哦~~~ 另外升级到wordpress3后有些文件改了，2.9.2版本以前的禁用自动保存的方法已经不再合适了，Goolge了下找到了wordpress3的禁用自动保存程序修改版。下面就分享下：WordPress 3.0 禁止修订版本、草稿自动保存且序号连续的方法。 一、在 wp-config.php 中添加以下代码： define('WP_POST_REVISIONS', false); define('AUTOSAVE_INTERVAL', false); 二、在 wp-admin\post-new.php 和 wp-admin\post.php 的两个文件中： 删除（注释）掉 //wp_enqueue_script('autosave'); 三、找到 wp-admin\includes\post.php 这个文件，这一步很关键： 在 $create_in_db = false; 上面添加 if ( $create_in_db ) { OK，就这样解决了wordpress个人认为比较烦人的自动保存功能，当然或许你不这样认为。那又怎么样呢…… 相关日志分享WordPress禁用自动保存以及防Spam技巧 (24)更改固定链接样式 (70)WordPress wp_title 模版标签 (111)WordPress 插件 CodeColorer (59)非常实用的 jQuery 验证码 (73)WordPress 随机文章按钮 (33) 订阅浩子： 有道, 鲜果, 抓虾, 哪吒, 九点, QQ邮箱, Google, [...]]]></description>
			<content:encoded><![CDATA[<p>2010年8月14日wordpress中文站“官方”终于更新了，发现后果断从后台升级更新至3.0.1，升级后一下舒坦了觉得心里一块石头放下去了。我偷偷的乐~~~真不是我说的，这CN.WordPress.ORG的速度那真是蜗牛般，差不多都快等到花儿都谢了，瞧！别人用英文版+民间语言包的早就体验上了，囧。<span id="more-164"></span></p>
<p>后台升级唯一怕的就是中途断了，如果没有备份数据那就糟了。14号晚上升级的时候我就属于那个如果，不过幸好升级平稳进行，一步到位。前段时间看到wordpress3刚刚发布出来的时候那个默认主题简洁明了！So，接下来就是断断续续的折腾这个TwentyTen主题了，如果盆友们还有什么意见请提出来哦~~~</p>
<p>另外升级到wordpress3后有些文件改了，<a href="http://haozer.com/disable-autosave-wp-defense-spam.html" target="_blank">2.9.2版本以前的禁用自动保存</a>的方法已经不再合适了，Goolge了下找到了wordpress3的禁用自动保存程序修改版。下面就分享下：WordPress 3.0 禁止修订版本、草稿自动保存且序号连续的方法。<br />
一、在 wp-config.php 中添加以下代码：</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:95%;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">define('WP_POST_REVISIONS', false);<br />
define('AUTOSAVE_INTERVAL', false);</div></div>
<p>二、在 wp-admin\post-new.php 和 wp-admin\post.php 的两个文件中：<br />
删除（注释）掉</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:95%;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">//wp_enqueue_script('autosave');</div></div>
<p>三、找到 wp-admin\includes\post.php 这个文件，这一步很关键：<br />
在</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:95%;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$create_in_db = false;</div></div>
<p>上面添加</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:95%;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">if ( $create_in_db ) {</div></div>
<p>OK，就这样解决了wordpress<strong>个人</strong>认为比较烦人的自动保存功能，当然或许你不这样认为。那又怎么样呢……</p>
<h3  class="related_post_title"><I><B>相关日志</B></I></h3><ul class="related_post"><li><a rel="bookmark" href="http://haozer.com/disable-autosave-wp-defense-spam.html" title="分享WordPress禁用自动保存以及防Spam技巧">分享WordPress禁用自动保存以及防Spam技巧</a> (24)</li><li><a rel="bookmark" href="http://haozer.com/permalink-redirect.html" title="更改固定链接样式">更改固定链接样式</a> (70)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-wp_title.html" title="WordPress wp_title 模版标签">WordPress wp_title 模版标签</a> (111)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-plugins-codecolorer.html" title="WordPress 插件 CodeColorer">WordPress 插件 CodeColorer</a> (59)</li><li><a rel="bookmark" href="http://haozer.com/jquery-buttoncaptcha.html" title="非常实用的 jQuery 验证码">非常实用的 jQuery 验证码</a> (73)</li><li><a rel="bookmark" href="http://haozer.com/wordpress-random-button.html" title="WordPress 随机文章按钮">WordPress 随机文章按钮</a> (33)</li></ul><div style="margin: 0;">
				<script type="text/javascript"><!--
				google_ad_client = "ca-pub-4651455768821115";
				/* 336x280, 创建于 10-6-4 */
				google_ad_slot = "3240066453";
				google_ad_width = 336;
				google_ad_height = 280;
				//-->
				</script>
				<script type="text/javascript"
				src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
				</script>
				</div><div>
				<b><a href="http://feed.haozer.com" target="_blank" title="订阅 浩子 Feed">订阅浩子</a>：</b>
				<a rel="nofollow" target="_blank" href="http://reader.youdao.com/b.do?url=http://feed.haozer.com">有道</a>, 
				<a rel="nofollow" target="_blank" href="http://www.xianguo.com/subscribe.php?url=http://feed.haozer.com">鲜果</a>, 
				<a rel="nofollow" target="_blank" href="http://www.zhuaxia.com/add_channel.php?url=httP://feed.haozer.com">抓虾</a>, 
				<a rel="nofollow" target="_blank" href="http://inezha.com/add?url=http://feed.haozer.com/">哪吒</a>, 
				<a rel="nofollow" target="_blank" href="http://9.douban.com/reader/subscribe?url=http://feed.haozer.com">九点</a>, 
				<a rel="nofollow" target="_blank" href="http://mail.qq.com/cgi-bin/feed?u=http://feed.haozer.com">QQ邮箱</a>, 
				<a rel="nofollow" target="_blank" href="https://www.google.com/reader/view/feed/http://feed.haozer.com">Google</a>, 
				<a rel="nofollow" target="_blank" href="http://list.qq.com/cgi-bin/qf_invite?id=01d504b1f6e8f1ba7c8a5467797220449af8087f4200d8e7">邮件订阅</a>
				</div>]]></content:encoded>
			<wfw:commentRss>http://haozer.com/upgrade-wordpress-3.html/feed</wfw:commentRss>
		<slash:comments>60</slash:comments>
		</item>
	</channel>
</rss>

