<?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; 分享|Share</title>
	<atom:link href="http://haozer.com/category/share/feed" rel="self" type="application/rss+xml" />
	<link>http://haozer.com</link>
	<description>为了逝去的纪念!</description>
	<lastBuildDate>Mon, 09 Jan 2012 12:03:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>毕加猪</title>
		<link>http://haozer.com/follow-your-dreams.html</link>
		<comments>http://haozer.com/follow-your-dreams.html#comments</comments>
		<pubDate>Mon, 09 Jan 2012 11:59:15 +0000</pubDate>
		<dc:creator>浩子</dc:creator>
				<category><![CDATA[分享|Share]]></category>
		<category><![CDATA[视频]]></category>

		<guid isPermaLink="false">http://haozer.com/?p=201</guid>
		<description><![CDATA[如果有一天我变成流氓，请告诉别人，我也清纯过。在我的世界里，我依旧纯洁，脏了的只是这个世界…… 相关日志南下北上&#8211;毕业了,不要来送我 (108)四川方言版之[我们的豪杰春香] (39)《昨天》一个80年生人的回忆——80后应该看的，应该懂的！ (5)视频教程手把手教你学Photoshop (0)[搞笑视频]周星驰买房子发生的房事 (0) 订阅浩子： 有道, 鲜果, 抓虾, 哪吒, 九点, QQ邮箱, Google, 邮件订阅]]></description>
			<content:encoded><![CDATA[<p>如果有一天我变成流氓，请告诉别人，我也清纯过。在我的世界里，我依旧纯洁，脏了的只是这个世界……</p>
<p><embed src="http://player.youku.com/player.php/sid/XMzEyMTc1MTE2/v.swf" quality="high" width="480" height="400" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash"></embed></p><h3  class="related_post_title"><I><B>相关日志</B></I></h3><ul class="related_post"><li><a rel="bookmark" href="http://haozer.com/bu-yao-lai-song-wo.html" title="南下北上&#8211;毕业了,不要来送我">南下北上&#8211;毕业了,不要来送我</a> (108)</li><li><a rel="bookmark" href="http://haozer.com/prank-kwae_geol-ghun_hyang.html" title="四川方言版之[我们的豪杰春香]">四川方言版之[我们的豪杰春香]</a> (39)</li><li><a rel="bookmark" href="http://haozer.com/yesterday-80.html" title="《昨天》一个80年生人的回忆——80后应该看的，应该懂的！">《昨天》一个80年生人的回忆——80后应该看的，应该懂的！</a> (5)</li><li><a rel="bookmark" href="http://haozer.com/video-photoshop.html" title="视频教程手把手教你学Photoshop">视频教程手把手教你学Photoshop</a> (0)</li><li><a rel="bookmark" href="http://haozer.com/comedy-video-house.html" title="[搞笑视频]周星驰买房子发生的房事">[搞笑视频]周星驰买房子发生的房事</a> (0)</li></ul><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/follow-your-dreams.html/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>十部高清陆小凤传奇电影</title>
		<link>http://haozer.com/luxiaofeng-film.html</link>
		<comments>http://haozer.com/luxiaofeng-film.html#comments</comments>
		<pubDate>Sat, 06 Aug 2011 11:38:39 +0000</pubDate>
		<dc:creator>浩子</dc:creator>
				<category><![CDATA[分享|Share]]></category>
		<category><![CDATA[电影]]></category>

		<guid isPermaLink="false">http://haozer.com/?p=195</guid>
		<description><![CDATA[陆小凤，一个被称为有着“四条眉毛”的传奇人物。古龙小说中与楚留香齐名。他生性风流，喜欢喝酒，欣赏美女，更重情义。他总能遇到十分稀奇的事，但总能以高超的智慧逢凶化吉，后人评曰：“翩翩人中凤，遨游九重天，纵无灵犀指，眉毛亦堪豪，尊其为“侠探。” 我对古龙写的陆小凤小说不感兴趣，不过十部陆小凤传奇电影看着很有意思，更多资料大家可以围观：百度百科陆小凤。今天和大家来分享这十部电影，当然网上在线观看到处都有，但是高清下载却很少搜到齐全的。剧情这些也不再贴了，参见上面链接。 第一部《陆小凤传奇之陆小凤前传》 1、在线观看：陆小凤前传 2、高清下载（请复制链接用下载工具下载）： http://mmspublic.m1905.com/flv/LbFeERwBHT3mgpGE_1.flv http://mmspublic.m1905.com/flv/LbFeERwBHT3mgpGE_2.flv http://mmspublic.m1905.com/flv/LbFeERwBHT3mgpGE_3.flv http://mmspublic.m1905.com/flv/LbFeERwBHT3mgpGE_4.flv http://mmspublic.m1905.com/flv/LbFeERwBHT3mgpGE_5.flv http://mmspublic.m1905.com/flv/LbFeERwBHT3mgpGE_6.flv 第二部《陆小凤传奇之铁鞋传奇》 1、在线观看：铁鞋传奇 2、高清下载（请复制链接用下载工具下载）： http://mmspublic.m1905.com/flv/IHEqwViNdspcVSrt_1.flv http://mmspublic.m1905.com/flv/IHEqwViNdspcVSrt_2.flv http://mmspublic.m1905.com/flv/IHEqwViNdspcVSrt_3.flv http://mmspublic.m1905.com/flv/IHEqwViNdspcVSrt_4.flv http://mmspublic.m1905.com/flv/IHEqwViNdspcVSrt_5.flv 第三部《陆小凤传奇之大金鹏王》 1、在线观看：大金鹏王 2、高清下载（请复制链接用下载工具下载）： http://mmspublic.m1905.com/flv/tJ1FCFponXhCPUVC_1.flv http://mmspublic.m1905.com/flv/tJ1FCFponXhCPUVC_2.flv http://mmspublic.m1905.com/flv/tJ1FCFponXhCPUVC_3.flv http://mmspublic.m1905.com/flv/tJ1FCFponXhCPUVC_4.flv http://mmspublic.m1905.com/flv/tJ1FCFponXhCPUVC_5.flv http://mmspublic.m1905.com/flv/tJ1FCFponXhCPUVC_6.flv 第四部《陆小凤传奇之绣花大盗》 1、在线观看：绣花大盗 2、高清下载（请复制链接用下载工具下载）： http://mmspublic.m1905.com/flv/1105/1105E58AE84CFCE6F7D4_001.flv http://mmspublic.m1905.com/flv/1105/1105E58AE84CFCE6F7D4_002.flv http://mmspublic.m1905.com/flv/1105/1105E58AE84CFCE6F7D4_003.flv http://mmspublic.m1905.com/flv/1105/1105E58AE84CFCE6F7D4_004.flv http://mmspublic.m1905.com/flv/1105/1105E58AE84CFCE6F7D4_005.flv 第五部《陆小凤传奇之决战前后》 1、在线观看：决战前后 2、高清下载（请复制链接用下载工具下载）： http://mmspublic.m1905.com/flv/mibbJpj9mUhERvfM_1.flv http://mmspublic.m1905.com/flv/mibbJpj9mUhERvfM_2.flv http://mmspublic.m1905.com/flv/mibbJpj9mUhERvfM_3.flv http://mmspublic.m1905.com/flv/mibbJpj9mUhERvfM_4.flv http://mmspublic.m1905.com/flv/mibbJpj9mUhERvfM_5.flv 第六部《陆小凤传奇之银钩赌坊》 1、在线观看：银钩赌坊 2、高清下载（请复制链接用下载工具下载）： http://mmspublic.m1905.com/flv/tcvE9dARhc6bYryK_1.flv http://mmspublic.m1905.com/flv/tcvE9dARhc6bYryK_2.flv http://mmspublic.m1905.com/flv/tcvE9dARhc6bYryK_3.flv http://mmspublic.m1905.com/flv/tcvE9dARhc6bYryK_4.flv http://mmspublic.m1905.com/flv/tcvE9dARhc6bYryK_5.flv 第七部《陆小凤传奇之幽灵山庄》 1、在线观看：幽灵山庄 2、高清下载（请复制链接用下载工具下载）： [...]]]></description>
			<content:encoded><![CDATA[<p>陆小凤，一个被称为有着“四条眉毛”的传奇人物。古龙小说中与楚留香齐名。他生性风流，喜欢喝酒，欣赏美女，更重情义。他总能遇到十分稀奇的事，但总能以高超的智慧逢凶化吉，后人评曰：“翩翩人中凤，遨游九重天，纵无灵犀指，眉毛亦堪豪，尊其为“侠探。”<span id="more-195"></span></p>
<p>我对古龙写的陆小凤小说不感兴趣，不过十部陆小凤传奇电影看着很有意思，更多资料大家可以围观：<a href="http://baike.baidu.com/view/40494.htm" target="_blank">百度百科陆小凤</a>。今天和大家来分享这十部电影，当然网上在线观看到处都有，但是高清下载却很少搜到齐全的。剧情这些也不再贴了，参见上面链接。</p>
<p><strong>第一部《陆小凤传奇之陆小凤前传》</strong><br />
1、在线观看：<a href="http://www.m1905.com/vod/85472.shtml" target="_blank">陆小凤前传</a><br />
2、高清下载（请复制链接用下载工具下载）：</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">http://mmspublic.m1905.com/flv/LbFeERwBHT3mgpGE_1.flv<br />
http://mmspublic.m1905.com/flv/LbFeERwBHT3mgpGE_2.flv<br />
http://mmspublic.m1905.com/flv/LbFeERwBHT3mgpGE_3.flv<br />
http://mmspublic.m1905.com/flv/LbFeERwBHT3mgpGE_4.flv<br />
http://mmspublic.m1905.com/flv/LbFeERwBHT3mgpGE_5.flv<br />
http://mmspublic.m1905.com/flv/LbFeERwBHT3mgpGE_6.flv</div></div>
<p><strong>第二部《陆小凤传奇之铁鞋传奇》</strong><br />
1、在线观看：<a href="http://www.m1905.com/vod/85473.shtml" target="_blank">铁鞋传奇</a><br />
2、高清下载（请复制链接用下载工具下载）：</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">http://mmspublic.m1905.com/flv/IHEqwViNdspcVSrt_1.flv<br />
http://mmspublic.m1905.com/flv/IHEqwViNdspcVSrt_2.flv<br />
http://mmspublic.m1905.com/flv/IHEqwViNdspcVSrt_3.flv<br />
http://mmspublic.m1905.com/flv/IHEqwViNdspcVSrt_4.flv<br />
http://mmspublic.m1905.com/flv/IHEqwViNdspcVSrt_5.flv</div></div>
<p><strong>第三部《陆小凤传奇之大金鹏王》</strong><br />
1、在线观看：<a href="http://www.m1905.com/vod/85468.shtml" target="_blank">大金鹏王</a><br />
2、高清下载（请复制链接用下载工具下载）：</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">http://mmspublic.m1905.com/flv/tJ1FCFponXhCPUVC_1.flv<br />
http://mmspublic.m1905.com/flv/tJ1FCFponXhCPUVC_2.flv<br />
http://mmspublic.m1905.com/flv/tJ1FCFponXhCPUVC_3.flv<br />
http://mmspublic.m1905.com/flv/tJ1FCFponXhCPUVC_4.flv<br />
http://mmspublic.m1905.com/flv/tJ1FCFponXhCPUVC_5.flv<br />
http://mmspublic.m1905.com/flv/tJ1FCFponXhCPUVC_6.flv</div></div>
<p><strong>第四部《陆小凤传奇之绣花大盗》</strong><br />
1、在线观看：<a href="http://www.m1905.com/vod/85474.shtml" target="_blank">绣花大盗</a><br />
2、高清下载（请复制链接用下载工具下载）：</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">http://mmspublic.m1905.com/flv/1105/1105E58AE84CFCE6F7D4_001.flv<br />
http://mmspublic.m1905.com/flv/1105/1105E58AE84CFCE6F7D4_002.flv<br />
http://mmspublic.m1905.com/flv/1105/1105E58AE84CFCE6F7D4_003.flv<br />
http://mmspublic.m1905.com/flv/1105/1105E58AE84CFCE6F7D4_004.flv<br />
http://mmspublic.m1905.com/flv/1105/1105E58AE84CFCE6F7D4_005.flv</div></div>
<p><strong>第五部《陆小凤传奇之决战前后》</strong><br />
1、在线观看：<a href="http://www.m1905.com/vod/85471.shtml" target="_blank">决战前后</a><br />
2、高清下载（请复制链接用下载工具下载）：</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">http://mmspublic.m1905.com/flv/mibbJpj9mUhERvfM_1.flv<br />
http://mmspublic.m1905.com/flv/mibbJpj9mUhERvfM_2.flv<br />
http://mmspublic.m1905.com/flv/mibbJpj9mUhERvfM_3.flv<br />
http://mmspublic.m1905.com/flv/mibbJpj9mUhERvfM_4.flv<br />
http://mmspublic.m1905.com/flv/mibbJpj9mUhERvfM_5.flv</div></div>
<p><strong>第六部《陆小凤传奇之银钩赌坊》</strong><br />
1、在线观看：<a href="http://www.m1905.com/vod/85476.shtml" target="_blank">银钩赌坊</a><br />
2、高清下载（请复制链接用下载工具下载）：</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">http://mmspublic.m1905.com/flv/tcvE9dARhc6bYryK_1.flv<br />
http://mmspublic.m1905.com/flv/tcvE9dARhc6bYryK_2.flv<br />
http://mmspublic.m1905.com/flv/tcvE9dARhc6bYryK_3.flv<br />
http://mmspublic.m1905.com/flv/tcvE9dARhc6bYryK_4.flv<br />
http://mmspublic.m1905.com/flv/tcvE9dARhc6bYryK_5.flv</div></div>
<p><strong>第七部《陆小凤传奇之幽灵山庄》</strong><br />
1、在线观看：<a href="http://www.m1905.com/vod/348593.shtml" target="_blank">幽灵山庄</a><br />
2、高清下载（请复制链接用下载工具下载）：</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">http://mmspublic.m1905.com/flv/JpnqqIrzObb0LtIO_1.flv<br />
http://mmspublic.m1905.com/flv/JpnqqIrzObb0LtIO_2.flv<br />
http://mmspublic.m1905.com/flv/JpnqqIrzObb0LtIO_3.flv<br />
http://mmspublic.m1905.com/flv/JpnqqIrzObb0LtIO_4.flv<br />
http://mmspublic.m1905.com/flv/JpnqqIrzObb0LtIO_5.flv</div></div>
<p><strong>第八部《陆小凤传奇之剑神一笑》</strong><br />
1、在线观看：<a href="http://www.m1905.com/vod/85470.shtml" target="_blank">剑神一笑</a><br />
2、高清下载（请复制链接用下载工具下载）：</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">http://mmspublic.m1905.com/flv/75QkDixvarRlejOn_1.flv<br />
http://mmspublic.m1905.com/flv/75QkDixvarRlejOn_2.flv<br />
http://mmspublic.m1905.com/flv/75QkDixvarRlejOn_3.flv<br />
http://mmspublic.m1905.com/flv/75QkDixvarRlejOn_4.flv<br />
http://mmspublic.m1905.com/flv/75QkDixvarRlejOn_5.flv</div></div>
<p><strong>第九部《陆小凤传奇之凤舞九天》</strong><br />
1、在线观看：<a href="http://www.m1905.com/vod/85469.shtml" target="_blank">凤舞九天</a><br />
2、高清下载（请复制链接用下载工具下载）：</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">http://mmspublic.m1905.com/flv/8hji69WQbAcxwGiP_1.flv<br />
http://mmspublic.m1905.com/flv/8hji69WQbAcxwGiP_2.flv<br />
http://mmspublic.m1905.com/flv/8hji69WQbAcxwGiP_3.flv<br />
http://mmspublic.m1905.com/flv/8hji69WQbAcxwGiP_4.flv<br />
http://mmspublic.m1905.com/flv/8hji69WQbAcxwGiP_5.flv</div></div>
<p><strong>第十部《陆小凤传奇之血衣之谜》</strong><br />
1、在线观看：<a href="http://www.m1905.com/vod/85475.shtml" target="_blank">血衣之谜</a><br />
2、高清下载（请复制链接用下载工具下载）：</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">http://mmspublic.m1905.com/flv/vTWj_mSYHJCb7c-J_1.flv<br />
http://mmspublic.m1905.com/flv/vTWj_mSYHJCb7c-J_2.flv<br />
http://mmspublic.m1905.com/flv/vTWj_mSYHJCb7c-J_3.flv<br />
http://mmspublic.m1905.com/flv/vTWj_mSYHJCb7c-J_4.flv<br />
http://mmspublic.m1905.com/flv/vTWj_mSYHJCb7c-J_5.flv</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/2011-6-1.html" title="装过节">装过节</a> (27)</li><li><a rel="bookmark" href="http://haozer.com/the-doctors.html" title="医者仁心">医者仁心</a> (17)</li><li><a rel="bookmark" href="http://haozer.com/the-eraser-in-my-brain.html" title="我脑中的橡皮擦">我脑中的橡皮擦</a> (20)</li><li><a rel="bookmark" href="http://haozer.com/global-movies.html" title="电影——全球票房100强">电影——全球票房100强</a> (2)</li></ul><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/luxiaofeng-film.html/feed</wfw:commentRss>
		<slash:comments>69</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>
				<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>
				<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>
				<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>
				<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>医者仁心</title>
		<link>http://haozer.com/the-doctors.html</link>
		<comments>http://haozer.com/the-doctors.html#comments</comments>
		<pubDate>Sat, 19 Mar 2011 07:16:09 +0000</pubDate>
		<dc:creator>浩子</dc:creator>
				<category><![CDATA[分享|Share]]></category>
		<category><![CDATA[电影]]></category>

		<guid isPermaLink="false">http://haozer.com/?p=181</guid>
		<description><![CDATA[《医者仁心》讲述了一家公立三甲医院一年多里发生的故事：老院长即将退休，雄心勃勃的副院长武明训即将接任，请回美国著名心脏外科医生钟立行助阵。医院接二连三出事，有管理上的疏忽，有技术上的失误，也有无力回天的医学局限。患者不理解，医闹煽风点火，个别医生利欲熏心，惹来无数麻烦，仁华医院一时成为火药桶…… 有两件事情 我愈是思考愈觉神奇 心中也愈充满敬畏 那就是 我头顶上的星空 与我内心的道德准则 ——摘自一位医生的手记 陆陆续续把《医者仁心》看完了，虽然和现实有些许不同，但我还是要向你们推荐，在目前的医疗环境下很有必要看一看。更多的信息请参考：1、豆瓣影评《医者仁心》via；2、百度百科《医者仁心》via。拯救人灵魂的是牧师，神话中复活人生命的是神，那么医生，就是牧师和神之间的那个人，无论是病家还是医生都要相互理解，大家都一直在努力着！ 在线观看：《医者仁心》 相关日志十部高清陆小凤传奇电影 (69)装过节 (27)我脑中的橡皮擦 (20)电影——全球票房100强 (2) 订阅浩子： 有道, 鲜果, 抓虾, 哪吒, 九点, QQ邮箱, Google, 邮件订阅]]></description>
			<content:encoded><![CDATA[<p>《医者仁心》讲述了一家公立三甲医院一年多里发生的故事：老院长即将退休，雄心勃勃的副院长武明训即将接任，请回美国著名心脏外科医生钟立行助阵。医院接二连三出事，有管理上的疏忽，有技术上的失误，也有无力回天的医学局限。患者不理解，医闹煽风点火，个别医生利欲熏心，惹来无数麻烦，仁华医院一时成为火药桶……<span id="more-181"></span></p>
<blockquote><p>有两件事情<br />
我愈是思考愈觉神奇<br />
心中也愈充满敬畏<br />
那就是<br />
我头顶上的星空<br />
与我内心的道德准则<br />
——摘自一位医生的手记</p></blockquote>
<p><a href="http://haozer.com/wp-content/uploads/181-the-doctors1.jpg" target="_blank"><img class="aligncenter" title="医者仁心1" src="http://haozer.com/wp-content/uploads/181-the-doctors1.jpg" alt="" /></a><br />
<a href="http://haozer.com/wp-content/uploads/181-the-doctors2.jpg" target="_blank"><img class="aligncenter" title="医者仁心2" src="http://haozer.com/wp-content/uploads/181-the-doctors2.jpg" alt="" /></a><br />
<a href="http://haozer.com/wp-content/uploads/181-the-doctors3.jpg" target="_blank"><img class="aligncenter" title="医者仁心3" src="http://haozer.com/wp-content/uploads/181-the-doctors3.jpg" alt="" /></a></p>
<p>陆陆续续把《医者仁心》看完了，虽然和现实有些许不同，但我还是要向你们推荐，在目前的医疗环境下很有必要看一看。更多的信息请参考：1、豆瓣影评《医者仁心》<a href="http://movie.douban.com/subject/5392035/" target="_blank">via</a>；2、百度百科《医者仁心》<a href="http://baike.baidu.com/view/3449027.htm" target="_blank">via</a>。<strong>拯救人灵魂的是牧师，神话中复活人生命的是神，那么医生，就是牧师和神之间的那个人</strong>，无论是病家还是医生都要相互理解，大家都一直在努力着！</p>
<p>在线观看：<a href="http://www.qiyi.com/dianshiju/yzrx.html" target="_blank">《医者仁心》</a></p>
<h3  class="related_post_title"><I><B>相关日志</B></I></h3><ul class="related_post"><li><a rel="bookmark" href="http://haozer.com/luxiaofeng-film.html" title="十部高清陆小凤传奇电影">十部高清陆小凤传奇电影</a> (69)</li><li><a rel="bookmark" href="http://haozer.com/2011-6-1.html" title="装过节">装过节</a> (27)</li><li><a rel="bookmark" href="http://haozer.com/the-eraser-in-my-brain.html" title="我脑中的橡皮擦">我脑中的橡皮擦</a> (20)</li><li><a rel="bookmark" href="http://haozer.com/global-movies.html" title="电影——全球票房100强">电影——全球票房100强</a> (2)</li></ul><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/the-doctors.html/feed</wfw:commentRss>
		<slash:comments>17</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>
				<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>免费送 VPN 了</title>
		<link>http://haozer.com/free-vpn.html</link>
		<comments>http://haozer.com/free-vpn.html#comments</comments>
		<pubDate>Sun, 10 Oct 2010 11:48:54 +0000</pubDate>
		<dc:creator>浩子</dc:creator>
				<category><![CDATA[分享|Share]]></category>
		<category><![CDATA[vpn]]></category>
		<category><![CDATA[免费]]></category>

		<guid isPermaLink="false">http://haozer.com/?p=173</guid>
		<description><![CDATA[今天传说是个很吉利的日子啊，2010 年 10 月 10 日，就差十时十分十秒了。网友都说今天是“萌节”，把萌字拆分了就是十月十日，囧，他们真 NB。为了配合节日的气氛，对此浩子部落格举行免费送 VPN 的活动。 如果你疑惑： 神马？VPN； 神马？免费 VPN； 神马？骗子，噱头…… 对，你没有看错，这不是噱头，我也不是骗子！如果你不知道什么是 VPN，那么请自行 Google 大叔或者 Baidu 大婶。如果你还是不了解 VPN，那么有时间就踩一脚，没时间就请绕行。如果？没有如果了…… 对于本次活动说明： 1、你必须要有个独立博客； 2、本文评论楼层为 10 的倍数算中奖，沙发（#1）不算，也就是 #10、#20、#30……为中将楼层。最多连续三层楼，超过的话此楼作废； 3、中奖后须在首页添加一个图片广告，要求请参见：http://aenes.com/archives/complimentary-programs-vpn.html； 4、VPN 帐户由博友 老T 提供，赠送的 VPN 保证在他还维护 VPN 服务器之前能一直免费使用，不可抗力因素除外； 5、目前送 5 个，需要的快快下手哦； 6、另外广告下老T的 WordPress 专业博客主机合租：http://service.aenes.com/。 相关日志Dreamweaver8超级免费视频教程—新手入门—网页制作—网站开发 (4)12月份四级六级真题听力免费下载 (3)分享些漂亮的404错误页面——免费下载 (8)[网站]经常关注的、极具参考价值的网站收集 (0)[不间断更新]Online地平线站长学院免费空间申请邀请码 (135)免费图片外链网站收集整理 (4) 订阅浩子： 有道, 鲜果, 抓虾, 哪吒, 九点, [...]]]></description>
			<content:encoded><![CDATA[<p>今天传说是个很吉利的日子啊，2010 年 10 月 10 日，就差十时十分十秒了。网友都说今天是“萌节”，把萌字拆分了就是十月十日，囧，他们真 NB。为了配合节日的气氛，对此浩子部落格举行免费送 VPN 的活动。<span id="more-173"></span></p>
<blockquote><p>如果你疑惑：<br />
神马？VPN；<br />
神马？免费 VPN；<br />
神马？骗子，噱头……</p></blockquote>
<p>对，你没有看错，这不是噱头，我也不是骗子！如果你不知道什么是 VPN，那么请自行 Google 大叔或者 Baidu 大婶。如果你还是不了解 VPN，那么有时间就踩一脚，没时间就请绕行。如果？没有如果了……</p>
<p><strong>对于本次活动说明：</strong><br />
1、你必须要有个独立博客；<br />
2、本文评论楼层为 10 的倍数算中奖，沙发（#1）不算，也就是 #10、#20、#30……为中将楼层。最多连续三层楼，超过的话此楼作废；<br />
3、<strong>中奖后须在首页添加一个图片广告，要求请参见：http://aenes.com/archives/complimentary-programs-vpn.html</strong>；<br />
4、VPN 帐户由博友 <a href="http://aenes.com/" target="_blank">老T</a> 提供，赠送的 VPN 保证在他还维护 VPN 服务器之前能一直免费使用，不可抗力因素除外；<br />
5、目前送 5 个，需要的快快下手哦；<br />
6、另外广告下老T的 WordPress 专业博客主机合租：http://service.aenes.com/。</p>
<h3  class="related_post_title"><I><B>相关日志</B></I></h3><ul class="related_post"><li><a rel="bookmark" href="http://haozer.com/dreamweaver8-video-tutorial.html" title="Dreamweaver8超级免费视频教程—新手入门—网页制作—网站开发">Dreamweaver8超级免费视频教程—新手入门—网页制作—网站开发</a> (4)</li><li><a rel="bookmark" href="http://haozer.com/cet-listening-download.html" title="12月份四级六级真题听力免费下载">12月份四级六级真题听力免费下载</a> (3)</li><li><a rel="bookmark" href="http://haozer.com/404-pages.html" title="分享些漂亮的404错误页面——免费下载">分享些漂亮的404错误页面——免费下载</a> (8)</li><li><a rel="bookmark" href="http://haozer.com/value-website.html" title="[网站]经常关注的、极具参考价值的网站收集">[网站]经常关注的、极具参考价值的网站收集</a> (0)</li><li><a rel="bookmark" href="http://haozer.com/free-online-invite.html" title="[不间断更新]Online地平线站长学院免费空间申请邀请码">[不间断更新]Online地平线站长学院免费空间申请邀请码</a> (135)</li><li><a rel="bookmark" href="http://haozer.com/free-pic-website.html" title="免费图片外链网站收集整理">免费图片外链网站收集整理</a> (4)</li></ul><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/free-vpn.html/feed</wfw:commentRss>
		<slash:comments>44</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>
				<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>
	</channel>
</rss>

