<?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>Hiro技术站 &#187; Wordpress</title>
	<atom:link href="http://www.ihiro.org/category/wordpress/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ihiro.org</link>
	<description></description>
	<lastBuildDate>Fri, 06 Jan 2012 07:58:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>WordPress:3.0版本特性，将改变你的内容管理方式</title>
		<link>http://www.ihiro.org/wordpress-3-new-features</link>
		<comments>http://www.ihiro.org/wordpress-3-new-features#comments</comments>
		<pubDate>Thu, 03 Jun 2010 02:43:54 +0000</pubDate>
		<dc:creator>Hiro</dc:creator>
				<category><![CDATA[Wordpress译文]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[业界信息]]></category>
		<category><![CDATA[开源]]></category>

		<guid isPermaLink="false">http://www.ihiro.org/?p=1454</guid>
		<description><![CDATA[<img src="http://www.ihiro.org/blog/wp-content/uploads/2010/06/wp_3_logo.jpg" alt="" title="wp_3_logo" width="100" height="100" class="alignleft size-full wp-image-1455" />
<p>大部分使用Wordpress的人都知道 Wordpress 3.0 已经发布。 虽然仍处于 beta 发布阶段，但你可以先安装个测试版本运行，并发现它很多的新功能。 很多人已使用 Wordpress 作为博客或者更多以外的很多用途，但3.0版本肯定将创造一个更加轻松管理内容的程序，不仅仅用来作为博客程序。</p>
<p>Wordpress是2003年第一次发布，打造了用来作为博主们建立博客的内容管理程序，而现今它已被认定为最流行的博客程序。Wordpress不断地用新的功能、特性在新的版本中更新出来，这样利用Wordpress已经完全可以搭建出一个完善的CMS，而不仅仅是博客。许多博主和一些大的商业公司都用Wordpress作为他们的CMS：CNN, Wall Street Journal, Nikon, Pepsi等等...Wordpress 3.0 已扩展成为用户友好创建一个完整的CMS网站的客户端...</p>
]]></description>
			<content:encoded><![CDATA[<p>大部分使用Wordpress的人都知道 WordPress 3.0 已经发布。 虽然仍处于 beta 发布阶段，但你可以先安装个测试版本运行，并发现它很多的新功能。 很多人已使用 WordPress 作为博客或者更多以外的很多用途，但3.0版本肯定将创造一个更加轻松管理内容的程序，不仅仅用来作为博客程序。</p>
<p>WordPress是2003年第一次发布，打造了用来作为博主们建立博客的内容管理程序，而现今它已被认定为最流行的博客程序。Wordpress不断地用新的功能、特性在新的版本中更新出来，这样利用Wordpress已经完全可以搭建出一个完善的CMS，而不仅仅是博客。许多博主和一些大的商业公司都用Wordpress作为他们的CMS：CNN, Wall Street Journal, Nikon, Pepsi等等&#8230;Wordpress 3.0 已扩展成为用户友好创建一个完整的CMS网站的客户端。</p>
<p>3.0正式版预定在5月发行的，但到了5月底都还没有发行。由此可见，3.0版本有可能推迟到6月初才能发行。在写这篇博文时，3.0的测试版本2已经发现，你可以点击链接下载：<a href="http://wordpress.org/development/2010/05/wordpress-3-0-beta-2/" rel="external">http://wordpress.org/development/2010/05/wordpress-3-0-beta-2/</a></p>
<h3>一、新菜单管理功能</h3>
<p>在我看来，该特性是3.0版本中最为期待的一个功能，在默认安装后即可使用。在此之前，一般都是通过一些插件或者Wordpress技巧来实现的，但这样相对复杂，普通用户一般都不能完成。而现在，它将变得非常的简单。<img src="http://www.ihiro.org/blog/wp-content/uploads/2010/06/wp_3_menuoptions.jpg" alt="" title="wp_3_menuoptions" width="540" height="463" class="aligncenter size-full wp-image-1456" /></p>
<p>你可以添加单页面、文章分类，甚至自定义网站链接。通过自定义网站链接特性，你可以直接连接到一篇博文、另一个网站，或者任何你想链接的地方。用户可以很友好地用来设置类似于目前的侧边栏小工具，你可以轻松地拖放来定制位置，只要你自己喜欢的话。</p>
<h3>二、自定义文章类型功能</h3>
<p>在已发行的版本中，你只能添加文章或者单页面。在3.0版本中，你可以创建你专属的自定义文章类型，并建立相应的字段将他们联系起来。比如一个用户选择创建一个叫“播客”类型的文章，那么程序将仅添加“播客”类型的文章，就是那么简单。你不必通过程序走一个复杂的过程，去解释为什么需要添加一个新的分类为“播客”的文章，只需要点击某一特定的类别并填写某些自定义字段即可。只需要一个简单的步骤，而不再需要一些插件。<img src="http://www.ihiro.org/blog/wp-content/uploads/2010/06/wp_3_posttype.jpg" alt="" title="wp_3_posttype" width="157" height="252" class="aligncenter size-full wp-image-1457" /></p>
<h3>三、多站点功能</h3>
<p>WordPress MU不久前宣布它将由一个独立的个体集成到Wordpress 3.0中。MU允许你通过一个管理员去管理多个站点。这对运行了多个站点或者博客的人来说是非常好的，只需一次登陆便可以在一个地方管理多个站点。这对于一些分享模板、内容、或者插件的站点来说是非常有用的。只需一次安装，即可用更少的工作和时间做同样的事情。<img src="http://www.ihiro.org/blog/wp-content/uploads/2010/06/wp_3_multisite.jpg" alt="" title="wp_3_multisite" width="540" height="331" class="aligncenter size-full wp-image-1458" /></p>
<p>3.0版本中默认是不开放该功能的，不过可以通过很简单的步骤即可开启该功能。首先在wp-config.php中添加下面的代码：</p>

<div class="wp_codebox"><table><tr id="p14541"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p1454code1"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WP_ALLOW_MULTISITE'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>然后在后台的Tools菜单栏下就会出现“Network”菜单。点击后输入Network Title、管理员邮件地址后，点击安装。 WordPress会让您自行选择设置这些站点是存放在次级领域还是次级目录下。  如果你将Wordpress安装在一个子文件夹中或者是在本地测试，Wordpress将会推荐你使用子目录。</p>
<h3>四、其他一些值得注意的功能</h3>
<p>1.在安装的过程中，你可以选择自己的用户名和密码，而不像之前的版本是默认的admin用户名，而密码是自动随机生成；</p>
<p>2.新的默认主题：2010。看起来貌似不错哦，简洁和轻量级，尽可能少的样式属性。<img src="http://www.ihiro.org/blog/wp-content/uploads/2010/06/wp_3_2010theme.jpg" alt="" title="wp_3_2010theme" width="540" height="456" class="aligncenter size-full wp-image-1459" /></p>
<p>本文整理和翻译自：<a href="http://webdesignledger.com/tools/wordpress-3-0-changing-the-way-we-manage-content" rel="external">http://webdesignledger.com/tools/wordpress-3-0-changing-the-way-we-manage-content</a></p>
<h2  class="related_post_title">你也许会喜欢阅读这些：</h2><ul class="related_post"><li>2009年09月13日 -- <a href="http://www.ihiro.org/wordpress-2-9-version-new-features" title="Wordpress:2.9版本&#8211;新的特性">Wordpress:2.9版本&#8211;新的特性</a> (13)</li><li>2010年09月13日 -- <a href="http://www.ihiro.org/information-september-2010-programming-language-list" title="资讯:2010年09月编程语言排行榜">资讯:2010年09月编程语言排行榜</a> (23)</li><li>2010年08月12日 -- <a href="http://www.ihiro.org/sizzle-custom-selector" title="Sizzle:开源JS选择器，如何自定义选择器">Sizzle:开源JS选择器，如何自定义选择器</a> (31)</li><li>2010年08月3日 -- <a href="http://www.ihiro.org/information-august-2010-programming-language-list" title="资讯:2010年08月编程语言排行榜">资讯:2010年08月编程语言排行榜</a> (12)</li><li>2010年07月9日 -- <a href="http://www.ihiro.org/information-july-2010-programming-language-list" title="资讯:2010年07月编程语言排行榜">资讯:2010年07月编程语言排行榜</a> (23)</li><li>2010年06月12日 -- <a href="http://www.ihiro.org/firefox-4-will-support-css3-calc-method" title="CSS:Firefox 4 将支持CSS3 calc方法">CSS:Firefox 4 将支持CSS3 calc方法</a> (18)</li><li>2010年06月9日 -- <a href="http://www.ihiro.org/information-june-2010-programming-languages-list" title="资讯:2010年06月编程语言排行榜">资讯:2010年06月编程语言排行榜</a> (13)</li><li>2010年05月23日 -- <a href="http://www.ihiro.org/information-may-2010-programming-language-list" title="资讯:2010年05月编程语言排行榜">资讯:2010年05月编程语言排行榜</a> (23)</li><li>2010年05月13日 -- <a href="http://www.ihiro.org/imagevue-gallery" title="开源:使用Imagevue Gallery搭建Flash动态相册">开源:使用Imagevue Gallery搭建Flash动态相册</a> (21)</li><li>2010年04月6日 -- <a href="http://www.ihiro.org/information-april-2010-programming-language-list" title="资讯:2010年04月编程语言排行榜">资讯:2010年04月编程语言排行榜</a> (10)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ihiro.org/wordpress-3-new-features/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Ajax:近期博客改版的增强Ajax加载说明</title>
		<link>http://www.ihiro.org/the-enhanced-ajax-effect-instructions</link>
		<comments>http://www.ihiro.org/the-enhanced-ajax-effect-instructions#comments</comments>
		<pubDate>Thu, 25 Mar 2010 14:05:21 +0000</pubDate>
		<dc:creator>Hiro</dc:creator>
				<category><![CDATA[Hack技巧]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.ihiro.org/?p=1185</guid>
		<description><![CDATA[<img src="http://www.ihiro.org/blog/wp-content/uploads/2010/03/ajax-wordpress.jpg" alt="" title="ajax-wordpress" width="100" height="100" class="alignleft size-full wp-image-1189" />
<p>近段时间来访问我博客的博友们不知是否注意到，博客的一些地方添加了一些增强型Ajax加载效果，用以提高访客的交互和快速浏览不同分类、标签下最新的文章列表。而在今天又新增了增强型Ajax提交评论和回复，只要你留言你就会看到具体效果。</p>
<p>花了精力添加这些Ajax效果，无非是为了让各位博友和来访者可以更加方便地阅读我的博客，同时也希望大家可以多多给我意见。每次添加新的功能我都会在左边的蓝条里写出来，大家可以一目了然地看到我最新的修改信息。</p>]]></description>
			<content:encoded><![CDATA[<p>近段时间来访问我博客的博友们不知是否注意到，博客的一些地方添加了一些增强型Ajax加载效果，用以提高访客的交互和快速浏览不同分类、标签下最新的文章列表。而在今天又新增了增强型Ajax提交评论和回复，只要你留言你就会看到具体效果。</p>
<p>下面我对几处增强Ajax效果进行一下具体说明，大家以后访问我博客时也可以适当地使用。之所以说是增强型Ajax效果，是因为我并没有改变原先的代码，而是在原始代码基础上添加了jQuery控制，这样即使jQuery代码没有加载完成时，你也可以访问到相应的页面。</p>
<h3>1.Ajax加载历史文章列表：</h3>
<p>在博客的右边有一个最新文章板块，大家可以看到在标题的右边有上页、下页的链接，点击相应的链接便可Ajax加载上下页的文章列表，每次加载10条。图：<img src="http://www.ihiro.org/blog/wp-content/uploads/2010/03/ajax-recent.png" alt="" title="ajax-recent" width="285" height="314" class="aligncenter size-full wp-image-1187" /></p>
<h3>2.分类Ajax加载相关最新10条文章记录：</h3>
<p>点击博客左边的每个摘要型Post的分类链接、博客右边的分类目录版块链接或者每篇完整型文章的分类链接。会出现一个loading的shadow层，加载完成后罗列出该分类下的最新文章。图：<img src="http://www.ihiro.org/blog/wp-content/uploads/2010/03/ajax-category.png" alt="" title="ajax-category" width="413" height="284" class="aligncenter size-full wp-image-1186" /></p>
<h3>3.标签Ajax加载相关最新10条文章记录：</h3>
<p>点击博客左边的每个摘要型Post的标签链接、博客右边的热门标签版块链接或者每篇完整型文章的标签链接。同样会出现一个loading的shadow层，加载完成后罗列出该标签下的最新文章。图：<img src="http://www.ihiro.org/blog/wp-content/uploads/2010/03/ajax-tag.png" alt="" title="ajax-tag" width="414" height="282" class="aligncenter size-full wp-image-1188" /></p>
<h3>4.Ajax提交评论和回复别人的留言：</h3>
<p>在此之前，没此提交评论后，当前页面都要重新加载一次，很是耗时。添加Ajax评论后，速度会更快，也大量减少了请求。我的博客一直只提供2层回复。不喜欢多层次回复，看着很难受！具体Ajax评论效果大家只需留言即可看到。</p>
<p>花了精力添加这些Ajax效果，无非是为了让各位博友和来访者可以更加方便地阅读我的博客，同时也希望大家可以多多给我意见。每次添加新的功能我都会在左边的蓝条里写出来，大家可以一目了然地看到我最新的修改信息。</p>
<p>希望我的努力可以让你多多回访，多多支持！！</p>
<h2  class="related_post_title">你也许会喜欢阅读这些：</h2><ul class="related_post"><li>2009年09月23日 -- <a href="http://www.ihiro.org/ajax-editing-in-placing" title="Ajax:当前页面更改内容，前端实现">Ajax:当前页面更改内容，前端实现</a> (14)</li><li>2010年10月21日 -- <a href="http://www.ihiro.org/jquery-plugin-recommended-maphighlight" title="jQuery:热区高亮maphighlight插件推荐">jQuery:热区高亮maphighlight插件推荐</a> (23)</li><li>2010年09月20日 -- <a href="http://www.ihiro.org/jquery-format-extend" title="jQuery:数字、字符串格式化扩展">jQuery:数字、字符串格式化扩展</a> (31)</li><li>2010年09月2日 -- <a href="http://www.ihiro.org/example-selectbox-simulation" title="示例:Selectbox模拟实现效果">示例:Selectbox模拟实现效果</a> (22)</li><li>2010年08月12日 -- <a href="http://www.ihiro.org/sizzle-custom-selector" title="Sizzle:开源JS选择器，如何自定义选择器">Sizzle:开源JS选择器，如何自定义选择器</a> (31)</li><li>2010年06月30日 -- <a href="http://www.ihiro.org/firebug-console-panel-function" title="Firebug:Javascript测试利器，Console面板函数详解">Firebug:Javascript测试利器，Console面板函数详解</a> (4)</li><li>2010年06月3日 -- <a href="http://www.ihiro.org/wordpress-3-new-features" title="Wordpress:3.0版本特性，将改变你的内容管理方式">Wordpress:3.0版本特性，将改变你的内容管理方式</a> (12)</li><li>2010年03月15日 -- <a href="http://www.ihiro.org/uncovering-jquerys-hidden-features" title="jQuery:揭露jQuery的隐藏功能">jQuery:揭露jQuery的隐藏功能</a> (5)</li><li>2010年02月26日 -- <a href="http://www.ihiro.org/a-rich-picture-effect-flash" title="jQuery:丰富效果的Flash图片播放（JS重写版）">jQuery:丰富效果的Flash图片播放（JS重写版）</a> (18)</li><li>2010年02月24日 -- <a href="http://www.ihiro.org/javascript-news-flash-header-tips" title="Javascript:新消息闪烁标题提示代码分享">Javascript:新消息闪烁标题提示代码分享</a> (7)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ihiro.org/the-enhanced-ajax-effect-instructions/feed</wfw:commentRss>
		<slash:comments>43</slash:comments>
		</item>
		<item>
		<title>WordPress:如何将GoogleBuzz数据插入到博客中</title>
		<link>http://www.ihiro.org/how-to-insert-googlebuzz-data-into-blog</link>
		<comments>http://www.ihiro.org/how-to-insert-googlebuzz-data-into-blog#comments</comments>
		<pubDate>Sat, 20 Feb 2010 03:31:12 +0000</pubDate>
		<dc:creator>Hiro</dc:creator>
				<category><![CDATA[Hack技巧]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[技巧]]></category>

		<guid isPermaLink="false">http://www.ihiro.org/?p=1118</guid>
		<description><![CDATA[<img src="http://www.ihiro.org/blog/wp-content/uploads/2010/02/google-buzz-logo.jpg" alt="" title="google-buzz-logo" width="100" height="100" class="alignleft size-full wp-image-1117" />
<p>我一直在试图找一种将一些实时状态消息集成到博客中作为公告消息的方法，Twitter被封，新浪围脖貌似没有公开的API，自己做一个吧，在别的网站上也不显示。好在月初的时候Google出了Buzz，这样我就可以有一个实时的公告了。</p>
<p>在国外的博客上发现了下面的一段代码，可以通过Ajax跨域读取Buzz数据，以Json数据格式返回，我只需将返回的数量罗列成一个列表即可。在代码中我使用的是匿名函数的方式（<label style="color:#f00;">一般只使用一次的函数体比较适用</label>），在函数体内部使用$.ajax()方法，通过设置dataType:'jsonp'来跨域读取json数据后，遍历数据获得列表并显示出来。</p>]]></description>
			<content:encoded><![CDATA[<p>我一直在试图找一种将一些实时状态消息集成到博客中作为公告消息的方法，Twitter被封，新浪围脖貌似没有公开的API，自己做一个吧，在别的网站上也不显示。好在月初的时候Google出了Buzz，这样我就可以有一个实时的公告了。</p>
<p>在国外的博客上发现了下面的一段代码，可以通过Ajax跨域读取Buzz数据，以Json数据格式返回，我只需将返回的数量罗列成一个列表即可。代码如下：</p>

<div class="wp_codebox"><table><tr id="p11182"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
</pre></td><td class="code" id="p1118code2"><pre class="javascript" style="font-family:monospace;">jQuery<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>
	<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>
		<span style="color: #003366; font-weight: bold;">var</span> username <span style="color: #339933;">=</span> <span style="color: #3366CC;">'hiro.zhd'</span><span style="color: #339933;">,</span>		<span style="color: #006600; font-style: italic;">//gmail用户名</span>
			num <span style="color: #339933;">=</span> <span style="color: #CC0000;">5</span><span style="color: #339933;">,</span>		<span style="color: #006600; font-style: italic;">//期望加载几条数据	</span>
			div <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#buzz'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	<span style="color: #006600; font-style: italic;">//列表显示的盒子</span>
&nbsp;
	   <span style="color: #006600; font-style: italic;">// 需要传给Google Feed API 的参数 : Buzz Feed URL, Number of Entries </span>
	   <span style="color: #003366; font-weight: bold;">var</span> data <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>q<span style="color: #339933;">:</span><span style="color: #3366CC;">'http://buzz.googleapis.com/feeds/'</span> <span style="color: #339933;">+</span> username <span style="color: #339933;">+</span> <span style="color: #3366CC;">'/public/posted'</span><span style="color: #339933;">,</span> 
				num<span style="color: #339933;">:</span>num<span style="color: #339933;">,</span>
				output<span style="color: #339933;">:</span><span style="color: #3366CC;">'json'</span><span style="color: #339933;">,</span>
				v<span style="color: #339933;">:</span><span style="color: #3366CC;">'1.0'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
	   <span style="color: #006600; font-style: italic;">// 调用Google Feed API</span>
	   $.<span style="color: #660066;">ajax</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
		  url<span style="color: #339933;">:</span><span style="color: #3366CC;">'http://ajax.googleapis.com/ajax/services/feed/load'</span><span style="color: #339933;">,</span>
		  data<span style="color: #339933;">:</span>data<span style="color: #339933;">,</span>
		  dataType<span style="color: #339933;">:</span><span style="color: #3366CC;">'jsonp'</span><span style="color: #339933;">,</span>
		  success<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>json<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			 <span style="color: #006600; font-style: italic;">// 通过Google Feed API返回json数据</span>
&nbsp;
			 <span style="color: #006600; font-style: italic;">// 若返回状态标记错误，给出错误提示信息</span>
			 <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>json.<span style="color: #660066;">responseStatus</span><span style="color: #339933;">!=</span><span style="color: #CC0000;">200</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				div.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;b style=&quot;color:red&quot;&gt;'</span><span style="color: #339933;">+</span> json.<span style="color: #660066;">responseDetails</span> <span style="color: #339933;">+</span><span style="color: #3366CC;">'&lt;/b&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #000066; font-weight: bold;">return</span><span style="color: #339933;">;</span> 
			 <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
			 <span style="color: #006600; font-style: italic;">// Buzz 记录是以一个数组返回</span>
			 <span style="color: #003366; font-weight: bold;">var</span> entries<span style="color: #339933;">=</span> json.<span style="color: #660066;">responseData</span>.<span style="color: #660066;">feed</span>.<span style="color: #660066;">entries</span><span style="color: #339933;">;</span>
			 <span style="color: #003366; font-weight: bold;">var</span> length<span style="color: #339933;">=</span> entries.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>
&nbsp;
			 <span style="color: #006600; font-style: italic;">// length为0，表示没有任何记录</span>
			 <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>length<span style="color: #339933;">==</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span><span style="color: #339933;">;</span> 
&nbsp;
			 <span style="color: #006600; font-style: italic;">// 默认开始添加一个隐藏的列表元素，以便后边动画地显示</span>
			 <span style="color: #003366; font-weight: bold;">var</span> ul <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;ul class=&quot;gb&quot; style=&quot;display:none&quot;&gt;&lt;/ul&gt;'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">appendTo</span><span style="color: #009900;">&#40;</span>div.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			 <span style="color: #006600; font-style: italic;">// 循环buzz数组</span>
			 <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&lt;</span>length <span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				<span style="color: #006600; font-style: italic;">// 格式化发布时间</span>
				<span style="color: #003366; font-weight: bold;">var</span> pDate <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span>entries<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">publishedDate</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #006600; font-style: italic;">// 获得内容</span>
				<span style="color: #003366; font-weight: bold;">var</span> snippet <span style="color: #339933;">=</span> entries<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">contentSnippet</span><span style="color: #339933;">;</span>
				<span style="color: #006600; font-style: italic;">// 通过正则表达式转换链接的http格式</span>
				snippet <span style="color: #339933;">=</span> snippet.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\b(https?\:\/\/\S+)/gi</span><span style="color: #339933;">,</span><span style="color: #3366CC;">' &lt;a href=&quot;$1&quot;&gt;$1'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
				ul.<span style="color: #660066;">append</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;li&gt;'</span>
				   <span style="color: #339933;">+</span><span style="color: #3366CC;">'&lt;span class=&quot;gb-content&quot;&gt;'</span><span style="color: #339933;">+</span> snippet <span style="color: #339933;">+</span><span style="color: #3366CC;">'&lt;/span&gt;'</span>
				   <span style="color: #339933;">+</span><span style="color: #3366CC;">'&lt;span class=&quot;gb-meta&quot;&gt;'</span>
					  <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;a href=&quot;'</span><span style="color: #339933;">+</span> entries<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">link</span> <span style="color: #339933;">+</span><span style="color: #3366CC;">'&quot;&gt;'</span><span style="color: #339933;">+</span> pDate.<span style="color: #660066;">toLocaleString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span><span style="color: #3366CC;">'&lt;/a&gt;'</span>
				   <span style="color: #339933;">+</span><span style="color: #3366CC;">'&lt;/span&gt;'</span>
				<span style="color: #339933;">+</span><span style="color: #3366CC;">'&lt;/li&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			 <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
			 ul.<span style="color: #660066;">fadeIn</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'slow'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		  <span style="color: #009900;">&#125;</span>
	   <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>jQuery<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>    <span style="color: #006600; font-style: italic;">//只有jQuery方法实例化完成后才执行</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>length<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>在此处我使用的是匿名函数的方式（<label style="color:#f00;">一般只使用一次的函数体比较适用</label>），在函数体内部使用$.ajax()方法，通过设置dataType:&#8217;jsonp&#8217;来跨域读取json数据后，遍历数据获得列表并显示出来。</p>
<p class="demo-down-bar"><a href="http://www.ihiro.org/cases/getGoogleBuzz/getGoogleBuzz.rar" class="download">download</a><a href="http://www.ihiro.org/cases/getGoogleBuzz/" rel="external" class="demo">demo</a></p>
<h2  class="related_post_title">你也许会喜欢阅读这些：</h2><ul class="related_post"><li>2009年09月16日 -- <a href="http://www.ihiro.org/including-wordpress-comment-reply-js" title="Wordpress:正确地引入comment-reply.js文件">Wordpress:正确地引入comment-reply.js文件</a> (23)</li><li>2009年09月6日 -- <a href="http://www.ihiro.org/highlight-the-administrators-reply-message" title="Wordpress:高亮管理员的留言信息">Wordpress:高亮管理员的留言信息</a> (37)</li><li>2009年08月31日 -- <a href="http://www.ihiro.org/4-ways-to-display-the-copyrights-of-blog" title="Wordpress:4个常见的显示博客版权的方法">Wordpress:4个常见的显示博客版权的方法</a> (10)</li><li>2011年04月1日 -- <a href="http://www.ihiro.org/html5-reading-note-chp4-canvas" title="HTML5:《HTML5. Up and Running》读书笔记.Chp4.Canvas">HTML5:《HTML5. Up and Running》读书笔记.Chp4.Canvas</a> (22)</li><li>2011年03月21日 -- <a href="http://www.ihiro.org/html5-reading-note-chp3-elements" title="HTML5:《HTML5. Up and Running》读书笔记.Chp3.Elements">HTML5:《HTML5. Up and Running》读书笔记.Chp3.Elements</a> (24)</li><li>2011年03月15日 -- <a href="http://www.ihiro.org/html5-reading-note-chp2-features" title="HTML5:《HTML5. Up and Running》读书笔记.Chp2.Features">HTML5:《HTML5. Up and Running》读书笔记.Chp2.Features</a> (23)</li><li>2011年03月2日 -- <a href="http://www.ihiro.org/css-specific-for-internet-explorer" title="CSS:区分IE版本的三个方法">CSS:区分IE版本的三个方法</a> (27)</li><li>2011年02月24日 -- <a href="http://www.ihiro.org/scroll-images" title="Javascript:图片无限循环滚动">Javascript:图片无限循环滚动</a> (27)</li><li>2010年12月30日 -- <a href="http://www.ihiro.org/javascript-getweek-by-date" title="Javascript:根据指定日期获得星期数">Javascript:根据指定日期获得星期数</a> (23)</li><li>2010年11月22日 -- <a href="http://www.ihiro.org/text-range" title="Range:文本框选区学习笔记">Range:文本框选区学习笔记</a> (16)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ihiro.org/how-to-insert-googlebuzz-data-into-blog/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>WordPress:将文章自动显示为两列</title>
		<link>http://www.ihiro.org/wordpress-the-article-automatically-appear-as-two</link>
		<comments>http://www.ihiro.org/wordpress-the-article-automatically-appear-as-two#comments</comments>
		<pubDate>Wed, 25 Nov 2009 15:53:26 +0000</pubDate>
		<dc:creator>Hiro</dc:creator>
				<category><![CDATA[Hack技巧]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[学习笔记]]></category>

		<guid isPermaLink="false">http://www.ihiro.org/?p=823</guid>
		<description><![CDATA[<img src="http://www.ihiro.org/blog/wp-content/uploads/2009/11/two-columns.gif" alt="two-columns" title="two-columns" width="100" height="100" class="alignleft size-full wp-image-813" />
<p>很多博客都有一行显示多个post文章的样式，他的原理其实非常简单，今天找到一段php代码，只需在functions.php文件中添加上，那么你的文章也会多列显示，非常实用！</p>
<p>1.打开functions.php文件，添加相应的php代码，通过判断是否是第二次输出来给出左右浮动的div标签。</p>
<p>2.完成在functions.php文件中添加好上面的代码后，记得打开style.css文件，添加上样式代码。</p>
<p>那么同理，我们可以根据判断$i变量来输出3列、4列等。<label style="color:#e40488;">只要想的到，就能做得到！</label></p>]]></description>
			<content:encoded><![CDATA[<p>很多博客都有一行显示多个post文章的样式，他的原理其实非常简单，今天找到一段php代码，只需在functions.php文件中添加上，那么你的文章也会多列显示，非常实用！</p>
<h3>1.PHP代码：</h3>
<p>打开functions.php文件，添加如下的php代码，通过判断是否是第二次输出来给出左右浮动的div标签。</p>

<div class="wp_codebox"><table><tr id="p8233"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
</pre></td><td class="code" id="p823code3"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php 
<span style="color: #000000; font-weight: bold;">function</span> my_multi_col<span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$columns</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;h2&gt;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$columns</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$column</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">%</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$return</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;div class=&quot;content_left&quot;&gt;'</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</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>
				<span style="color: #000088;">$return</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;h2&gt;&quot;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$return</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;div class=&quot;content_right&quot;&gt;&lt;h2&gt;'</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #000088;">$return</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$column</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$return</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;/h2&gt;&lt;/div&gt;&quot;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$i</span><span style="color: #339933;">++;</span>
		<span style="color: #009900;">&#125;</span>
&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;">$columns</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</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>
			<span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> wpautop<span style="color: #009900;">&#40;</span><span style="color: #000088;">$return</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> wpautop<span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$content</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'the_content'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'my_multi_col'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #339933;">&lt;/</span>h2<span style="color: #339933;">&gt;&lt;/</span>div<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>代码中的h2是你的每个文章标题所包含的标签。</p>
<h3>2.CSS代码：</h3>
<p>完成在functions.php文件中添加好上面的代码后，记得打开style.css文件，添加上样式代码。</p>

<div class="wp_codebox"><table><tr id="p8234"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code" id="p823code4"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.content_right</span><span style="color: #00AA00;">,</span> <span style="color: #6666ff;">.content_left</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">45%</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.content_left</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.content_right</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>那么同理，我们可以根据判断$i变量来输出3列、4列等。<label style="color:#e40488;">只要想的到，就能做得到！</label></p>
<h2  class="related_post_title">你也许会喜欢阅读这些：</h2><ul class="related_post"><li>2009年07月24日 -- <a href="http://www.ihiro.org/display-tags-in-a-dropdown-list-box" title="Wordpress:显示tags在一个下拉列表中">Wordpress:显示tags在一个下拉列表中</a> (8)</li><li>2009年09月16日 -- <a href="http://www.ihiro.org/including-wordpress-comment-reply-js" title="Wordpress:正确地引入comment-reply.js文件">Wordpress:正确地引入comment-reply.js文件</a> (23)</li><li>2009年08月31日 -- <a href="http://www.ihiro.org/4-ways-to-display-the-copyrights-of-blog" title="Wordpress:4个常见的显示博客版权的方法">Wordpress:4个常见的显示博客版权的方法</a> (10)</li><li>2009年08月13日 -- <a href="http://www.ihiro.org/the-reason-of-update-password-reset-loophole" title="Wordpress:最新2.84更新的原因：密码重置漏洞（图文教程解决）">Wordpress:最新2.84更新的原因：密码重置漏洞（图文教程解决）</a> (15)</li><li>2009年07月30日 -- <a href="http://www.ihiro.org/how-to-remove-the-version-information-in-wordpress" title="Wordpress:如何去除wp中的版本信息">Wordpress:如何去除wp中的版本信息</a> (16)</li><li>2009年07月22日 -- <a href="http://www.ihiro.org/2-wp-tips" title="Wordpress:两个wp的小技巧，非常实用哦！">Wordpress:两个wp的小技巧，非常实用哦！</a> (12)</li><li>2009年07月20日 -- <a href="http://www.ihiro.org/custom-and-configure-a-single-page-template" title="Wordpress:自定义单页模板的制作和配置">Wordpress:自定义单页模板的制作和配置</a> (20)</li><li>2009年06月18日 -- <a href="http://www.ihiro.org/wordpress-study-notes-url-settings" title="WordPress学习笔记&#8211;url设置">WordPress学习笔记&#8211;url设置</a> (8)</li><li>2011年04月20日 -- <a href="http://www.ihiro.org/css3-transition" title="CSS3:Transition属性详解">CSS3:Transition属性详解</a> (82)</li><li>2011年04月1日 -- <a href="http://www.ihiro.org/html5-reading-note-chp4-canvas" title="HTML5:《HTML5. Up and Running》读书笔记.Chp4.Canvas">HTML5:《HTML5. Up and Running》读书笔记.Chp4.Canvas</a> (22)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ihiro.org/wordpress-the-article-automatically-appear-as-two/feed</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>主题:我的第三个主题innerNews提供下载</title>
		<link>http://www.ihiro.org/my-third-theme-innernews</link>
		<comments>http://www.ihiro.org/my-third-theme-innernews#comments</comments>
		<pubDate>Sun, 08 Nov 2009 04:38:32 +0000</pubDate>
		<dc:creator>Hiro</dc:creator>
				<category><![CDATA[原创主题]]></category>
		<category><![CDATA[Theme]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.ihiro.org/?p=765</guid>
		<description><![CDATA[<img src="http://www.ihiro.org/blog/wp-content/uploads/2009/11/inner-logo.gif" alt="inner-logo" title="inner-logo" width="100" height="100" class="alignleft size-full wp-image-778" />
<p>在之前的文章（<a href="http://www.ihiro.org/a-new-job" rel="external">工作:辞去旧的工作，迎来新的工作</a>）曾说将共享内部新闻的主题，今天得闲终于可以实现了。之所以说是第三个主题，是因为根据时间来决定的。第一个主题在（<a href="http://www.ihiro.org/my-first-theme-for-download" ） rel="external">主题：我的第一个主题ihiro提供下载了</a>)一文中已经共享给大家，而第二个主题则是我现在用的（暂不共享）。</p>
<p>今天共享的该主题非常简约，是我在前一家留学公司时为公司内部新闻发布而制作的主题。既然是内部新闻，所以是一定要登录了才可以查看的。整个主题文件夹非常精简，总大小13.6k，包括主要的文件index.php、style.css外，只有两个用户分隔的背景图。因为只是用于发表内部新闻的缘故，没有添加评论功能。</p>
<p>介绍函数：<label style="color:#06C;">wp_loginout()</label>和<label style="color:#06C;">wp_logout_url($_SERVER['REQUEST_URI'])</label>的区别</p>
<p style="color:#f00;">该主题因需要登录，所以有点局限性，适合公司内部使用。也可以去掉相应的判断代码即可无需登录了。</p>]]></description>
			<content:encoded><![CDATA[<p>在之前的文章（<a href="http://www.ihiro.org/a-new-job" rel="external">工作:辞去旧的工作，迎来新的工作</a>）曾说将共享内部新闻的主题，今天得闲终于可以实现了。之所以说是第三个主题，是因为根据时间来决定的。第一个主题在（<a href="http://www.ihiro.org/my-first-theme-for-download" ） rel="external">主题：我的第一个主题ihiro提供下载了</a>)一文中已经共享给大家，而第二个主题则是我现在用的（暂不共享）。</p>
<p>今天共享的该主题非常简约，是我在前一家留学公司时为公司内部新闻发布而制作的主题。既然是内部新闻，所以是一定要登录了才可以查看的。整个主题文件夹非常精简，总大小13.6k，包括主要的文件index.php、style.css外，只有两个用户分隔的背景图。因为只是用于发表内部新闻的缘故，没有添加评论功能。</p>
<p>该主题的登录页面的配色是根据我博客当前主题的配色设计，而登录后的配色则是根据Decilicous网站的配色设计。（具体可见附图）</p>
<p class="demo-down-bar"><a href="downloads/themes/innerNews.rar" rel="external" class="download">download</a></p>
<h3>一、登录界面：</h3>
<p>你在输入了网址后，首先看到的是登录页面。该功能主要是根据Wordpress的条件判断标签：is_user_logged_in()，只有登录的用户才可以查看博客的内容，否则只会看到登录界面。</p>
<p>在此还要介绍两个函数的作用：<br />
1.<label style="color:#06C;">wp_loginout()</label>:该函数是大多的主要用来退出登录状态的链接函数，但退出后博客会自动跳转到Wordpress后台登录的界面；该函数使用后产生的是一个a标签包含的链接，并且包含了链接的文字“退出”，使用该函数不可更改退出这两个字。</p>
<p>2.<label style="color:#06C;">wp_logout_url($_SERVER['REQUEST_URI'])</label>：该函数也可以实现退出功能，但他使用后只是生成一个链接地址，而没有被a标签包含。所以需要自己使用a标签，将该删除写在a标签的href属性里，那么这样我们可以自定义a标签的链接文字了。并且该链接点击后不会跳转到任何其他页面，仍显示当前的页面（有点Ajax的味道！）。</p>
<p>登录界面的截图：<img src="http://www.ihiro.org/blog/wp-content/uploads/2009/11/preview-00.JPG" alt="preview-00" title="preview-00" width="445" height="254" class="aligncenter size-full wp-image-768" /></p>
<h3>二、登录后的主界面：</h3>
<p>主界面是采用的两栏布局，左窄右宽。配色采用Delicious风格，用了一个x轴重复的背景图来分隔左边的板块，永了一个长的突变来分隔右边的每个post，这样便于阅读。截图（点击看全图）：<br />
<a href="http://www.ihiro.org/blog/wp-content/uploads/2009/11/preview-01.png" rel="external"><img src="http://www.ihiro.org/blog/wp-content/uploads/2009/11/preview-01-thum.jpg" alt="preview-01-thum" title="preview-01-thum" width="501" height="286" class="aligncenter size-full wp-image-771" /></a></p>
<h3>三、单个Post的界面：</h3>
<p>单个post的界面只是将文章内容全部显示，将文章链接去除，在这用到is_single()判断函数，在此函数下不使用a标签即可。截图（点击看全图）：<br />
<a href="http://www.ihiro.org/blog/wp-content/uploads/2009/11/preview-02.png" rel="external"><img src="http://www.ihiro.org/blog/wp-content/uploads/2009/11/preview-02-thum.jpg" alt="preview-02-thum" title="preview-02-thum" width="499" height="274" class="aligncenter size-full wp-image-774" /></a></p>
<h3>总结:</h3>
<p>最近没什么时间做新的主题，该主题中的有些函数应用还是不错的，若你研究的话可以发现如何使用条件判断实现将多个文件集合在一个index.php文件中（在第一个主题中也得以体现了）。该主题因需要登录，所以有点局限性，适合公司内部使用。淡然你若喜欢该风格的主界面，也可以去掉相应的判断代码即可无需登录了。</p>
<p>希望大家继续支持我，有空我会在做一些实用的主题的。</p>
<h2  class="related_post_title">你也许会喜欢阅读这些：</h2><ul class="related_post"><li>2009年08月5日 -- <a href="http://www.ihiro.org/my-first-theme-for-download" title="主题：我的第一个主题ihiro提供下载了">主题：我的第一个主题ihiro提供下载了</a> (101)</li><li>2010年06月3日 -- <a href="http://www.ihiro.org/wordpress-3-new-features" title="Wordpress:3.0版本特性，将改变你的内容管理方式">Wordpress:3.0版本特性，将改变你的内容管理方式</a> (12)</li><li>2010年03月25日 -- <a href="http://www.ihiro.org/the-enhanced-ajax-effect-instructions" title="Ajax:近期博客改版的增强Ajax加载说明">Ajax:近期博客改版的增强Ajax加载说明</a> (43)</li><li>2010年02月20日 -- <a href="http://www.ihiro.org/how-to-insert-googlebuzz-data-into-blog" title="Wordpress:如何将GoogleBuzz数据插入到博客中">Wordpress:如何将GoogleBuzz数据插入到博客中</a> (11)</li><li>2009年11月25日 -- <a href="http://www.ihiro.org/wordpress-the-article-automatically-appear-as-two" title="Wordpress:将文章自动显示为两列">Wordpress:将文章自动显示为两列</a> (13)</li><li>2009年09月16日 -- <a href="http://www.ihiro.org/including-wordpress-comment-reply-js" title="Wordpress:正确地引入comment-reply.js文件">Wordpress:正确地引入comment-reply.js文件</a> (23)</li><li>2009年09月13日 -- <a href="http://www.ihiro.org/wordpress-2-9-version-new-features" title="Wordpress:2.9版本&#8211;新的特性">Wordpress:2.9版本&#8211;新的特性</a> (13)</li><li>2009年09月6日 -- <a href="http://www.ihiro.org/highlight-the-administrators-reply-message" title="Wordpress:高亮管理员的留言信息">Wordpress:高亮管理员的留言信息</a> (37)</li><li>2009年08月31日 -- <a href="http://www.ihiro.org/4-ways-to-display-the-copyrights-of-blog" title="Wordpress:4个常见的显示博客版权的方法">Wordpress:4个常见的显示博客版权的方法</a> (10)</li><li>2009年08月13日 -- <a href="http://www.ihiro.org/the-reason-of-update-password-reset-loophole" title="Wordpress:最新2.84更新的原因：密码重置漏洞（图文教程解决）">Wordpress:最新2.84更新的原因：密码重置漏洞（图文教程解决）</a> (15)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ihiro.org/my-third-theme-innernews/feed</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>WordPress:正确地引入comment-reply.js文件</title>
		<link>http://www.ihiro.org/including-wordpress-comment-reply-js</link>
		<comments>http://www.ihiro.org/including-wordpress-comment-reply-js#comments</comments>
		<pubDate>Wed, 16 Sep 2009 05:33:25 +0000</pubDate>
		<dc:creator>Hiro</dc:creator>
				<category><![CDATA[Hack技巧]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[技巧]]></category>

		<guid isPermaLink="false">http://www.ihiro.org/?p=590</guid>
		<description><![CDATA[<img src="http://www.ihiro.org/blog/wp-content/uploads/2009/09/comment.jpg" alt="comment" title="comment" width="100" height="100" class="alignleft wp-image-592" />
<p>评论回复功能是自Wordpress2.7版本后就有了的功能，它的实现原理是通过引入了一个js文件（也就是我今天讲到的js文件）。不过现在更多的博主们选择了分层留言的插件，这些插件其实也继承了该js文件的功能。而就我个人的博客来说，评论回复分层我是通过引入comment-reply.js文件实现的，没有使用评论插件，所以也没有一些附加的功能。</p>
<p>引入comment-reply.js的方法有三种：</p>
<p><strong>1.根据判断条件加载；&#160;&#160;&#160;&#160;2.更加健壮的判断条件；&#160;&#160;&#160;&#160;3.在function.php中添加action。</strong></p>]]></description>
			<content:encoded><![CDATA[<p>评论回复功能是自Wordpress2.7版本后就有了的功能，它的实现原理是通过引入了一个js文件（也就是我今天讲到的js文件）。不过现在更多的博主们选择了分层留言的插件，这些插件其实也继承了该js文件的功能。而就我个人的博客来说，评论回复分层我是通过引入comment-reply.js文件实现的，没有使用评论插件，所以也没有一些附加的功能。</p>
<p>引入comment-reply.js的方法有三种：</p>
<h3>1.方法一:根据判断条件加载</h3>
<p>在header.php文件的head标签内添加如下代码：</p>

<div class="wp_codebox"><table><tr id="p5905"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p590code5"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> is_singular<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> wp_enqueue_script<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'comment-reply'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>其中的 is_singular() 是集合了is_single()和is_page()两个判断的功能，根据此判断条件判断后只有在但页面时才会加载comment-reply.js文件。
</p>
<h3>2.方法二:更加健壮的判断条件</h3>
<p>同样在header.php文件的head标签内添加代码：</p>

<div class="wp_codebox"><table><tr id="p5906"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p590code6"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> is_singular<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> AND comments_open<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> AND <span style="color: #009900;">&#40;</span>get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'thread_comments'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
  wp_enqueue_script<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'comment-reply'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>该段代码的好处是判断条件的增多，使得代码更加健壮。</p>
<h3>3.方法三:在function.php中添加action</h3>
<p>在function.php文件中添加如下代码：</p>

<div class="wp_codebox"><table><tr id="p5907"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code" id="p590code7"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php
<span style="color: #000000; font-weight: bold;">function</span> theme_queue_js<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>is_admin<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> is_singular<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> AND comments_open<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> AND <span style="color: #009900;">&#40;</span>get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'thread_comments'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
      wp_enqueue_script<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'comment-reply'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'get_header'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'theme_queue_js'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>主要是通过添加一个action实现过滤加载。</p>
<h2  class="related_post_title">你也许会喜欢阅读这些：</h2><ul class="related_post"><li>2009年08月31日 -- <a href="http://www.ihiro.org/4-ways-to-display-the-copyrights-of-blog" title="Wordpress:4个常见的显示博客版权的方法">Wordpress:4个常见的显示博客版权的方法</a> (10)</li><li>2010年02月20日 -- <a href="http://www.ihiro.org/how-to-insert-googlebuzz-data-into-blog" title="Wordpress:如何将GoogleBuzz数据插入到博客中">Wordpress:如何将GoogleBuzz数据插入到博客中</a> (11)</li><li>2009年11月25日 -- <a href="http://www.ihiro.org/wordpress-the-article-automatically-appear-as-two" title="Wordpress:将文章自动显示为两列">Wordpress:将文章自动显示为两列</a> (13)</li><li>2009年09月6日 -- <a href="http://www.ihiro.org/highlight-the-administrators-reply-message" title="Wordpress:高亮管理员的留言信息">Wordpress:高亮管理员的留言信息</a> (37)</li><li>2009年08月13日 -- <a href="http://www.ihiro.org/the-reason-of-update-password-reset-loophole" title="Wordpress:最新2.84更新的原因：密码重置漏洞（图文教程解决）">Wordpress:最新2.84更新的原因：密码重置漏洞（图文教程解决）</a> (15)</li><li>2009年07月24日 -- <a href="http://www.ihiro.org/display-tags-in-a-dropdown-list-box" title="Wordpress:显示tags在一个下拉列表中">Wordpress:显示tags在一个下拉列表中</a> (8)</li><li>2011年03月2日 -- <a href="http://www.ihiro.org/css-specific-for-internet-explorer" title="CSS:区分IE版本的三个方法">CSS:区分IE版本的三个方法</a> (27)</li><li>2010年06月3日 -- <a href="http://www.ihiro.org/wordpress-3-new-features" title="Wordpress:3.0版本特性，将改变你的内容管理方式">Wordpress:3.0版本特性，将改变你的内容管理方式</a> (12)</li><li>2010年05月17日 -- <a href="http://www.ihiro.org/target-every-version-of-ie-from-a-single-stylesheet" title="CSS:通过一个样式表区分IE的各个版本">CSS:通过一个样式表区分IE的各个版本</a> (11)</li><li>2010年03月25日 -- <a href="http://www.ihiro.org/the-enhanced-ajax-effect-instructions" title="Ajax:近期博客改版的增强Ajax加载说明">Ajax:近期博客改版的增强Ajax加载说明</a> (43)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ihiro.org/including-wordpress-comment-reply-js/feed</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>WordPress:2.9版本&#8211;新的特性</title>
		<link>http://www.ihiro.org/wordpress-2-9-version-new-features</link>
		<comments>http://www.ihiro.org/wordpress-2-9-version-new-features#comments</comments>
		<pubDate>Sun, 13 Sep 2009 04:07:07 +0000</pubDate>
		<dc:creator>Hiro</dc:creator>
				<category><![CDATA[Wordpress译文]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[业界信息]]></category>

		<guid isPermaLink="false">http://www.ihiro.org/?p=580</guid>
		<description><![CDATA[<img src="http://www.ihiro.org/blog/wp-content/uploads/2009/09/wordpress-2.9-logo.jpg" alt="wordpress-2.9-logo" title="wordpress-2.9-logo" width="100" height="100" class="alignleft wp-image-581" />
<p>最近从网络上了解了一些关于Wordpress的下一个版本2.9的一些新特性，总结了几个与大家分享分享，也好让大家对新的版本的到来更加充满期待。</p>
<h3>特性一：图像编辑器</h3>
<h3>特性二： excerpt过滤器</h3>
<h3>特性三：评论垃圾回收站</h3>
<p>另附上最新的Wordpress的Cheat Sheet文档：<a href="http://www.ihiro.org/downloads/Wordpress-Cheat-Sheet.pdf" rel="external">下载地址</a></p>]]></description>
			<content:encoded><![CDATA[<p>最近从网络上了解了一些关于Wordpress的下一个版本2.9的一些新特性，总结了几个与大家分享分享，也好让大家对新的版本的到来更加充满期待。</p>
<h3>特性一：图像编辑器</h3>
<p>貌似网络上是有这样的插件存在，但在wordpress2.9版本中，该特性不再是一个插件，而是wordpress的一个后台部分，可以通过该特性在博客的后台对图像进行一些编辑，以满足网页布局的需要。<br />
特性截图：<br />
<img src="http://www.ihiro.org/blog/wp-content/uploads/2009/09/wp-image-edit1.png" alt="wp-image-edit1" title="wp-image-edit1" width="421" height="202" class="aligncenter size-full wp-image-582" /><br />
<img src="http://www.ihiro.org/blog/wp-content/uploads/2009/09/wp-image-edit2.png" alt="wp-image-edit2" title="wp-image-edit2" width="503" height="650" class="aligncenter size-full wp-image-583" /><br />
<img src="http://www.ihiro.org/blog/wp-content/uploads/2009/09/wp-image-edit3.png" alt="wp-image-edit3" title="wp-image-edit3" width="442" height="720" class="aligncenter size-full wp-image-584" /></p>
<h3>特性二： excerpt过滤器</h3>
<p>在wordpress2.9版本中新增加了两个过滤器来调整excerpt(the_excerpt())摘要部分，通过修改返回值的方式达到调整摘要字符串长度和more链接的文字。只需在function.php文件中添加如下代码即可(版本2.9可用):</p>

<div class="wp_codebox"><table><tr id="p5808"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code" id="p580code8"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// 更改excerpt()摘要的字符长度，可以通过修改返回值实现</span>
<span style="color: #000000; font-weight: bold;">function</span> new_excerpt_length<span style="color: #009900;">&#40;</span><span style="color: #000088;">$length</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">40</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'excerpt_length'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'new_excerpt_length'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// 修改excerpt()的more链接的文字，同样可以通过修改返回值实现</span>
<span style="color: #000000; font-weight: bold;">function</span> new_excerpt_more<span style="color: #009900;">&#40;</span><span style="color: #000088;">$more</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'...'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'excerpt_more'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'new_excerpt_more'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

</p>
<h3>特性三：评论垃圾回收站</h3>
<p>在wordpress2.9版本中将添加评论垃圾回收站的功能，你可以将一些无用的评论删除，而这些被删除的评论就暂时保存在回收站中，直到过期，你可以在wp_config.php文件中定义过期的时间长度，代码如下：</p>

<div class="wp_codebox"><table><tr id="p5809"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p580code9"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'EMPTY_TRASH_DAYS'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">30</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>特性截图：<br />
<img src="http://www.ihiro.org/blog/wp-content/uploads/2009/09/trash-comment1.png" alt="trash-comment1" title="trash-comment1" width="436" height="182" class="aligncenter size-full wp-image-585" /><br />
<img src="http://www.ihiro.org/blog/wp-content/uploads/2009/09/trash-comment2.png" alt="trash-comment2" title="trash-comment2" width="351" height="145" class="aligncenter size-full wp-image-586" /></p>
<p>另附上最新的Wordpress的Cheat Sheet文档：<a href="http://www.ihiro.org/downloads/Wordpress-Cheat-Sheet.pdf" rel="external">下载地址</a></p>
<h2  class="related_post_title">你也许会喜欢阅读这些：</h2><ul class="related_post"><li>2010年06月3日 -- <a href="http://www.ihiro.org/wordpress-3-new-features" title="Wordpress:3.0版本特性，将改变你的内容管理方式">Wordpress:3.0版本特性，将改变你的内容管理方式</a> (12)</li><li>2010年09月13日 -- <a href="http://www.ihiro.org/information-september-2010-programming-language-list" title="资讯:2010年09月编程语言排行榜">资讯:2010年09月编程语言排行榜</a> (23)</li><li>2010年08月3日 -- <a href="http://www.ihiro.org/information-august-2010-programming-language-list" title="资讯:2010年08月编程语言排行榜">资讯:2010年08月编程语言排行榜</a> (12)</li><li>2010年07月9日 -- <a href="http://www.ihiro.org/information-july-2010-programming-language-list" title="资讯:2010年07月编程语言排行榜">资讯:2010年07月编程语言排行榜</a> (23)</li><li>2010年06月12日 -- <a href="http://www.ihiro.org/firefox-4-will-support-css3-calc-method" title="CSS:Firefox 4 将支持CSS3 calc方法">CSS:Firefox 4 将支持CSS3 calc方法</a> (18)</li><li>2010年06月9日 -- <a href="http://www.ihiro.org/information-june-2010-programming-languages-list" title="资讯:2010年06月编程语言排行榜">资讯:2010年06月编程语言排行榜</a> (13)</li><li>2010年05月23日 -- <a href="http://www.ihiro.org/information-may-2010-programming-language-list" title="资讯:2010年05月编程语言排行榜">资讯:2010年05月编程语言排行榜</a> (23)</li><li>2010年04月6日 -- <a href="http://www.ihiro.org/information-april-2010-programming-language-list" title="资讯:2010年04月编程语言排行榜">资讯:2010年04月编程语言排行榜</a> (10)</li><li>2010年03月25日 -- <a href="http://www.ihiro.org/the-enhanced-ajax-effect-instructions" title="Ajax:近期博客改版的增强Ajax加载说明">Ajax:近期博客改版的增强Ajax加载说明</a> (43)</li><li>2010年03月9日 -- <a href="http://www.ihiro.org/information-march-2010-programming-language-list" title="资讯:2010年03月编程语言排行榜">资讯:2010年03月编程语言排行榜</a> (7)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ihiro.org/wordpress-2-9-version-new-features/feed</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>WordPress:高亮管理员的留言信息</title>
		<link>http://www.ihiro.org/highlight-the-administrators-reply-message</link>
		<comments>http://www.ihiro.org/highlight-the-administrators-reply-message#comments</comments>
		<pubDate>Sun, 06 Sep 2009 05:48:21 +0000</pubDate>
		<dc:creator>Hiro</dc:creator>
				<category><![CDATA[Hack技巧]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[技巧]]></category>

		<guid isPermaLink="false">http://www.ihiro.org/?p=548</guid>
		<description><![CDATA[<img src="http://www.ihiro.org/blog/wp-content/uploads/2009/09/highlight-admin-comment.jpg" alt="highlight-admin-comment" title="highlight-admin-comment" width="100" height="100" class="alignleft size-full wp-image-551" />
<p>在wp中有着管理员回复留言者的功能，但是正常的情况下，管理员和评论者的留言信息的样式是一样的，所以一眼看上去没什么区别。只能通过查看是否有admin这个人的留言信息。但是更多的博主们喜欢用自己心仪的英文名来显示，从而代替了默认的admin显示名。那么对阅读者来说，貌似留言都来自于访问者，而没有管理员的回复留言。</p>
<p>那么我总结了两个高亮管理员的留言的方法。</p>
<p><strong>方法一： 简单的固定管理员方法；方法二：自动侦测管理员邮箱。</strong></p>]]></description>
			<content:encoded><![CDATA[<p>在wp中有着管理员回复留言者的功能，但是正常的情况下，管理员和评论者的留言信息的样式是一样的，所以一眼看上去没什么区别。只能通过查看是否有admin这个人的留言信息。但是更多的博主们喜欢用自己心仪的英文名来显示，从而代替了默认的admin显示名。那么对阅读者来说，貌似留言都来自于访问者，而没有管理员的回复留言。</p>
<p>那么我总结了两个高亮管理员的留言的方法。方法如下：</p>
<h3>方法一、 简单的固定管理员方法：</h3>
<p>该方法只有当管理员的邮箱地址是固定不变的时候才可以生效，若改变的管理员的邮箱地址，那么也需要在源代码中修改相应的地址。所以该方法比较适合一个人固定邮箱地址的博客。<br />
<br />打开comments.php文件，若管理员只有一个人，添加如下代码：</p>

<div class="wp_codebox"><table><tr id="p54810"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code" id="p548code10"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php
      <span style="color: #000088;">$admin_email</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;hiro.zhd@gmail.com&quot;</span><span style="color: #339933;">;</span>
&nbsp;
       <span style="color: #000088;">$admin_comment</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>   <span style="color: #666666; font-style: italic;">//设置一个布尔类型的变量来判断该留言是否为管理员的留言</span>
&nbsp;
       <span style="color: #666666; font-style: italic;">//如果该留言是管理员的留言</span>
       <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$comment</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">comment_author_email</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$admin_email</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>  
            <span style="color: #000088;">$admin_comment</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>  
            <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>  
       <span style="color: #009900;">&#125;</span>  
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>当然若一个博客有多个管理员的话，可以使用一个数组来存放这些管理员的邮箱地址，那么该方法的源代码是：</p>

<div class="wp_codebox"><table><tr id="p54811"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code" id="p548code11"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php  
     <span style="color: #000088;">$admin_emails</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
                                <span style="color: #0000ff;">&quot;hiro.zhd@gmail.com&quot;</span><span style="color: #339933;">,</span>
                                <span style="color: #0000ff;">&quot;hiro@ihiro.org&quot;</span><span style="color: #339933;">,</span>
                                <span style="color: #0000ff;">&quot;hiro@gmail.com&quot;</span>
                           <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>     
&nbsp;
     <span style="color: #000088;">$admin_comment</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>     <span style="color: #666666; font-style: italic;">//设置一个布尔类型的变量来判断该留言是否为管理员的留言</span>
     <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$admin_emails</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$admin_email</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>  
         <span style="color: #666666; font-style: italic;">//如果该留言是管理员的留言 </span>
         <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$comment</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">comment_author_email</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$admin_email</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>  
             <span style="color: #000088;">$admin_comment</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>  
             <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>  
         <span style="color: #009900;">&#125;</span>  
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>  
 <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>最后在使用xhtml来控制留言列表时，只需判断$admin_comment的布尔值即可，为真则该留言是管理员的留言，为假，则是来访者的留言，xhtml源码如下：</p>

<div class="wp_codebox"><table><tr id="p54812"><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code" id="p548code12"><pre class="html" style="font-family:monospace;">&lt;li class=&quot;&lt;?php if($admin_comment) echo 'admincomment'; ?&gt;&quot;&gt;  
     &lt;!-- 这里输出其他的html信息 --&gt;  
&lt;/li&gt;</pre></td></tr></table></div>

<p>最后，只需对类admincomment样式化即可突出管理员的留言(样式化的css则可以自己随意更改)，如：</p>

<div class="wp_codebox"><table><tr id="p54813"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p548code13"><pre class="css" style="font-family:monospace;">.admincomment<span style="color: #00AA00;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#191919</span><span style="color: #00AA00;">;</span> 
      <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#FFF</span><span style="color: #00AA00;">;</span> 
      <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span><span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#333</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

</p>
<h3>方法二、自动侦测管理员邮箱：</h3>
<p>只需添加一些与数据库操作的php代码即可自动侦查到博客中所有管理员的邮箱地址，从而存储在一个数组中，代码如下：</p>

<div class="wp_codebox"><table><tr id="p54814"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code" id="p548code14"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php   
     <span style="color: #000088;">$user_level</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">8</span><span style="color: #339933;">;</span>   <span style="color: #666666; font-style: italic;">//默认地，wp有1-10是个数字来控制wp中用户的角色（如管理员、编辑、作者、阅读者等），而管理员的数字则是8</span>
     <span style="color: #000088;">$admin_emails</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>   <span style="color: #666666; font-style: italic;">//用来存放侦查到的所有管理员邮箱地址的数组 </span>
&nbsp;
     <span style="color: #666666; font-style: italic;">//从数据库中查找做角色数字为8的所有管理员帐号</span>
     <span style="color: #000088;">$admin_accounts</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: #0000ff;">&quot;SELECT * FROM <span style="color: #006699; font-weight: bold;">$wpdb-&gt;usermeta</span> WHERE meta_key = 'wp_user_level' AND meta_value &gt;= <span style="color: #006699; font-weight: bold;">$user_level</span> &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
&nbsp;
     <span style="color: #666666; font-style: italic;">//获得每个管理员各自的邮箱地址</span>
     <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$admin_accounts</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$admin_account</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>  
         <span style="color: #000088;">$admin_info</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_row</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT * FROM <span style="color: #006699; font-weight: bold;">$wpdb-&gt;users</span> WHERE ID = <span style="color: #006699; font-weight: bold;">$admin_account-&gt;user_id</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
&nbsp;
         <span style="color: #666666; font-style: italic;">//将管理员的邮箱地址添加到存放的数组中 </span>
         <span style="color: #000088;">$admin_emails</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$admin_account</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">user_id</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$admin_info</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">user_email</span><span style="color: #339933;">;</span>  
     <span style="color: #009900;">&#125;</span>     
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>既然获得了所有管理员的邮箱地址，那么剩下的工作就和方法一的多个管理员判断一样了，即：</p>

<div class="wp_codebox"><table><tr id="p54815"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code" id="p548code15"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php  
     <span style="color: #000088;">$admin_comment</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>     <span style="color: #666666; font-style: italic;">//设置一个布尔类型的变量来判断该留言是否为管理员的留言</span>
     <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$admin_emails</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$admin_email</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>  
         <span style="color: #666666; font-style: italic;">//如果该留言是管理员的留言 </span>
         <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$comment</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">comment_author_email</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$admin_email</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>  
             <span style="color: #000088;">$admin_comment</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>  
             <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>  
         <span style="color: #009900;">&#125;</span>  
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>  
 <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>然后xhtml代码：</p>

<div class="wp_codebox"><table><tr id="p54816"><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code" id="p548code16"><pre class="html" style="font-family:monospace;">&lt;li class=&quot;&lt;?php if($admin_comment) echo 'admincomment'; ?&gt;&quot;&gt;  
     &lt;!-- 这里输出其他的html信息 --&gt;  
&lt;/li&gt;</pre></td></tr></table></div>

<p>css代码：</p>

<div class="wp_codebox"><table><tr id="p54817"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p548code17"><pre class="css" style="font-family:monospace;">.admincomment<span style="color: #00AA00;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#191919</span><span style="color: #00AA00;">;</span> 
      <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#FFF</span><span style="color: #00AA00;">;</span> 
      <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span><span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#333</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

</p>
<p>那么到此为止，高亮管理员留言的方法介绍完毕。希望可以给大家带去点帮助！</p>
<h2  class="related_post_title">你也许会喜欢阅读这些：</h2><ul class="related_post"><li>2010年02月20日 -- <a href="http://www.ihiro.org/how-to-insert-googlebuzz-data-into-blog" title="Wordpress:如何将GoogleBuzz数据插入到博客中">Wordpress:如何将GoogleBuzz数据插入到博客中</a> (11)</li><li>2009年09月16日 -- <a href="http://www.ihiro.org/including-wordpress-comment-reply-js" title="Wordpress:正确地引入comment-reply.js文件">Wordpress:正确地引入comment-reply.js文件</a> (23)</li><li>2009年08月31日 -- <a href="http://www.ihiro.org/4-ways-to-display-the-copyrights-of-blog" title="Wordpress:4个常见的显示博客版权的方法">Wordpress:4个常见的显示博客版权的方法</a> (10)</li><li>2011年03月2日 -- <a href="http://www.ihiro.org/css-specific-for-internet-explorer" title="CSS:区分IE版本的三个方法">CSS:区分IE版本的三个方法</a> (27)</li><li>2010年06月3日 -- <a href="http://www.ihiro.org/wordpress-3-new-features" title="Wordpress:3.0版本特性，将改变你的内容管理方式">Wordpress:3.0版本特性，将改变你的内容管理方式</a> (12)</li><li>2010年05月17日 -- <a href="http://www.ihiro.org/target-every-version-of-ie-from-a-single-stylesheet" title="CSS:通过一个样式表区分IE的各个版本">CSS:通过一个样式表区分IE的各个版本</a> (11)</li><li>2010年03月25日 -- <a href="http://www.ihiro.org/the-enhanced-ajax-effect-instructions" title="Ajax:近期博客改版的增强Ajax加载说明">Ajax:近期博客改版的增强Ajax加载说明</a> (43)</li><li>2009年11月25日 -- <a href="http://www.ihiro.org/wordpress-the-article-automatically-appear-as-two" title="Wordpress:将文章自动显示为两列">Wordpress:将文章自动显示为两列</a> (13)</li><li>2009年11月8日 -- <a href="http://www.ihiro.org/my-third-theme-innernews" title="主题:我的第三个主题innerNews提供下载">主题:我的第三个主题innerNews提供下载</a> (24)</li><li>2009年09月13日 -- <a href="http://www.ihiro.org/wordpress-2-9-version-new-features" title="Wordpress:2.9版本&#8211;新的特性">Wordpress:2.9版本&#8211;新的特性</a> (13)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ihiro.org/highlight-the-administrators-reply-message/feed</wfw:commentRss>
		<slash:comments>37</slash:comments>
		</item>
		<item>
		<title>WordPress:4个常见的显示博客版权的方法</title>
		<link>http://www.ihiro.org/4-ways-to-display-the-copyrights-of-blog</link>
		<comments>http://www.ihiro.org/4-ways-to-display-the-copyrights-of-blog#comments</comments>
		<pubDate>Mon, 31 Aug 2009 10:06:03 +0000</pubDate>
		<dc:creator>Hiro</dc:creator>
				<category><![CDATA[Hack技巧]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[技巧]]></category>

		<guid isPermaLink="false">http://www.ihiro.org/?p=519</guid>
		<description><![CDATA[<img src="http://www.ihiro.org/blog/wp-content/uploads/2009/08/copyright-dates.jpg" alt="copyright-dates" title="copyright-dates" width="100" height="100" class="alignleft wp-image-520" />
<p>在之前的我的一篇博文：<a href="http://www.iconspedia.com/">两个wp的小技巧，非常实用哦！</a>中曾经讲到过一种动态地显示版权年限信息的方法。而今天我是总结了多个方法与大家分享。</p>
<p>1. 傻瓜式输入；<br />
2. php的date函数输出；<br />
3. 显示一段年限的版权；<br />
4. 在functions.php中添加功能函数(自动侦查式)。
</p>
<p>这四种方式是逐渐增强的，大家可以根据自己的喜好选择一种方式来显示自己的版权年限。</p>]]></description>
			<content:encoded><![CDATA[<p>在之前的我的一篇博文：<a href="http://www.iconspedia.com/">两个wp的小技巧，非常实用哦！</a>中曾经讲到过一种动态地显示版权年限信息的方法。而今天我是总结了多个方法与大家分享。</p>
<h3>1. 傻瓜式输入：</h3>
<p>看这个方法的名字就知道了，该方法纯正就是手动地输入版权信息：</p>

<div class="wp_codebox"><table><tr id="p51918"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p519code18"><pre class="html" style="font-family:monospace;"> Copyright&amp;copy; 2009. &lt;a href=&quot;www.ihiro.org&quot;&gt;Hiro's Blog&lt;/a&gt;</pre></td></tr></table></div>

<p>这样手动输入的方法好处是加载处理的速度快，缺点是每年都要手动更新一次！<br />
输出格式：Copyright © 2009 Hiro&#8217;s Blog</p>
<h3>2. php的date函数输出：</h3>
<p>
<div class="wp_codebox"><table><tr id="p51919"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p519code19"><pre class="php" style="font-family:monospace;">Copyright <span style="color: #339933;">&amp;</span>copy<span style="color: #339933;">;</span> <span style="color: #339933;">&lt;</span> ?php <span style="color: #b1b100;">echo</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">.&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php echo get_option('home'); ?&gt;&quot;</span><span style="color: #339933;">&gt;&lt;</span> ?php bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>该方法的好处时，每年自动更新为当年的年份，无需人为地更改。<br />
输出格式：Copyright © 2009 Hiro&#8217;s Blog
</p>
<h3>3. 显示一段年限的版权：</h3>
<p>
博客建立的时间过了一年了，那么博客的版权年限就应该更新为如：2008-2009的格式了。该方法其实很简单，就是基于第二个方法实现的。因为建博的时间是死的，所以完全可以用纯的html输入,而当年的年限则用date()函数动态地输出：</p>

<div class="wp_codebox"><table><tr id="p51920"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p519code20"><pre class="php" style="font-family:monospace;">Copyright <span style="color: #339933;">&amp;</span>copy<span style="color: #339933;">;</span> <span style="color: #cc66cc;">2008</span><span style="color: #339933;">-&lt;</span> ?php <span style="color: #b1b100;">echo</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">.&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php echo get_option('home'); ?&gt;&quot;</span><span style="color: #339933;">&gt;&lt;</span> ?php bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>
输出格式：Copyright © 2008-2009 Hiro&#8217;s Blog
</p>
<h3>4. 在functions.php中添加功能函数(自动侦查式)：</h3>
<p>只需打开主题中的functions.php文件，添加如下代码：</p>

<div class="wp_codebox"><table><tr id="p51921"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code" id="p519code21"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php 
<span style="color: #000000; font-weight: bold;">function</span> copyrightDate<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$copyright_dates</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: #0000ff;">&quot;
		SELECT 
			YEAR(min(post_date_gmt)) AS firstdate, 
			YEAR(max(post_date_gmt)) AS lastdate 
		FROM 
			<span style="color: #006699; font-weight: bold;">$wpdb-&gt;posts</span>
	&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$copyright_dates</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$copyright</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Copyright &amp;copy; &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$copyright_dates</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;">firstdate</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$copyright_dates</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;">firstdate</span> <span style="color: #339933;">!=</span> <span style="color: #000088;">$copyright_dates</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;">lastdate</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$copyright</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'-'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$copyright_dates</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;">lastdate</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$copyright</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&amp;nbsp;&quot;</span> <span style="color: #339933;">.</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp_footer'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'copyrightDate'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>该方法可以动态地检查你的建博时间，若你的建博时间不满一年，则输出格式和第二种方法一样，即：Copyright © 2009 Hiro&#8217;s Blog<br />
若你的博客建立了超过一年的时间，则输出的格式和第三种方法一样，即：Copyright © 2009-2010 Hiro&#8217;s Blog
</p>
<h3>总结</h3>
<p>这四种方式是逐渐增强的，大家可以根据自己的喜好选择一种方式来显示自己的版权年限。</p>
<h2  class="related_post_title">你也许会喜欢阅读这些：</h2><ul class="related_post"><li>2009年09月16日 -- <a href="http://www.ihiro.org/including-wordpress-comment-reply-js" title="Wordpress:正确地引入comment-reply.js文件">Wordpress:正确地引入comment-reply.js文件</a> (23)</li><li>2010年02月20日 -- <a href="http://www.ihiro.org/how-to-insert-googlebuzz-data-into-blog" title="Wordpress:如何将GoogleBuzz数据插入到博客中">Wordpress:如何将GoogleBuzz数据插入到博客中</a> (11)</li><li>2009年11月25日 -- <a href="http://www.ihiro.org/wordpress-the-article-automatically-appear-as-two" title="Wordpress:将文章自动显示为两列">Wordpress:将文章自动显示为两列</a> (13)</li><li>2009年09月6日 -- <a href="http://www.ihiro.org/highlight-the-administrators-reply-message" title="Wordpress:高亮管理员的留言信息">Wordpress:高亮管理员的留言信息</a> (37)</li><li>2009年08月13日 -- <a href="http://www.ihiro.org/the-reason-of-update-password-reset-loophole" title="Wordpress:最新2.84更新的原因：密码重置漏洞（图文教程解决）">Wordpress:最新2.84更新的原因：密码重置漏洞（图文教程解决）</a> (15)</li><li>2009年07月24日 -- <a href="http://www.ihiro.org/display-tags-in-a-dropdown-list-box" title="Wordpress:显示tags在一个下拉列表中">Wordpress:显示tags在一个下拉列表中</a> (8)</li><li>2011年03月2日 -- <a href="http://www.ihiro.org/css-specific-for-internet-explorer" title="CSS:区分IE版本的三个方法">CSS:区分IE版本的三个方法</a> (27)</li><li>2010年06月3日 -- <a href="http://www.ihiro.org/wordpress-3-new-features" title="Wordpress:3.0版本特性，将改变你的内容管理方式">Wordpress:3.0版本特性，将改变你的内容管理方式</a> (12)</li><li>2010年05月17日 -- <a href="http://www.ihiro.org/target-every-version-of-ie-from-a-single-stylesheet" title="CSS:通过一个样式表区分IE的各个版本">CSS:通过一个样式表区分IE的各个版本</a> (11)</li><li>2010年03月25日 -- <a href="http://www.ihiro.org/the-enhanced-ajax-effect-instructions" title="Ajax:近期博客改版的增强Ajax加载说明">Ajax:近期博客改版的增强Ajax加载说明</a> (43)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ihiro.org/4-ways-to-display-the-copyrights-of-blog/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>WordPress:最新2.84更新的原因：密码重置漏洞（图文教程解决）</title>
		<link>http://www.ihiro.org/the-reason-of-update-password-reset-loophole</link>
		<comments>http://www.ihiro.org/the-reason-of-update-password-reset-loophole#comments</comments>
		<pubDate>Thu, 13 Aug 2009 02:49:37 +0000</pubDate>
		<dc:creator>Hiro</dc:creator>
				<category><![CDATA[Hack技巧]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.ihiro.org/?p=415</guid>
		<description><![CDATA[<img src="http://www.wprecipes.com/wp-content/uploads/2009/08/security.jpg" alt="security" width="100" height="100" class="alignleft" />
<p>昨天登录后台发现wordpress2.84版本提示更新，这距离2.83版本的发布才几天而已的时间。是什么原因导致wp更新如此迅速了。到国外的网站和wp官方搜索了资料一看，原来是密码重置的漏洞。如果你的wp版本是2.83或低于2.83的，你就要注意了。千万别得罪人啊，特别是玩wp的人，小心他把你的邮箱给发爆了（开个玩笑，呵呵！）。</p>
<p><strong>解决的办法：</strong>1. 立即升级到2.84版本；2.修改wp-login.php文件，将190行的代码：if ( empty( $key ) ) 修改为： if ( empty( $key ) &#124;&#124; is_array( $key ) )。</p>]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.wprecipes.com/wp-content/uploads/2009/08/security.jpg" alt="security" width="150" height="150" class="alignright" /></p>
<p>昨天登录后台发现wordpress2.84版本提示更新，这距离2.83版本的发布才几天而已的时间。是什么原因导致wp更新如此迅速了。到国外的网站和wp官方搜索了资料一看，原来是密码重置的漏洞。如果你的wp版本是2.83或低于2.83的，你就要注意了。千万别得罪人啊，特别是玩wp的人，小心他把你的邮箱给发爆了（开个玩笑，呵呵！）。</p>
<p>那么，这个漏洞的所在是？你不妨自己小测一下。（以下所有图片都是我个人测试所截的图，仅供大家参考，我的密码已经更改，漏洞也已经修复，请勿试图攻击我哦！）。</p>
<h3>1.测试漏洞步骤：</h3>
<p>访问：http://你的域名/wp-login.php?action=rp&#038;key[]=（通过该链接可以直接跳过邮件论证而将博客的管理员密码重置），系统提示如图：<br />
<img src="http://www.ihiro.org/blog/wp-content/uploads/2009/08/5.jpg" alt="confirm-password" title="5" width="331" height="130" class="size-full aligncenter wp-image-422" /><br />
此时你可以看到你的邮箱中有新邮件了，内容如下：<br />
<img src="http://www.ihiro.org/blog/wp-content/uploads/2009/08/6.jpg" alt="new-password" title="6" width="247" height="79" class="size-full aligncenter wp-image-423" /><br />
至此，你的密码重置成功。<strong>恭喜你，你发现wordpress的漏洞了！！</strong></p>
<h3>2.漏洞源代码所在:</h3>
<p>打开wp-login.php文件（wordpress的更目录）,找到185行代码：如下：</p>

<div class="wp_codebox"><table><tr id="p41522"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code" id="p415code22"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> reset_password<span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$key</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/[^a-z0-9]/i'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$key</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$key</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">new</span> WP_Error<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'invalid_key'</span><span style="color: #339933;">,</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Invalid key'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$user</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_row</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">prepare</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT * FROM <span style="color: #006699; font-weight: bold;">$wpdb-&gt;users</span> WHERE user_activation_key = <span style="color: #009933; font-weight: bold;">%s</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$key</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$user</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">new</span> WP_Error<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'invalid_key'</span><span style="color: #339933;">,</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Invalid key'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//后面的代码过长，在此省略.......</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>然后在转到275行：如下</p>

<div class="wp_codebox"><table><tr id="p41523"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code" id="p415code23"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$action</span> <span style="color: #339933;">=</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'action'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'action'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">'login'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$errors</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> WP_Error<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&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;">'key'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
	<span style="color: #000088;">$action</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'resetpass'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// validate action so as to default to the login screen</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$action</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'logout'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'lostpassword'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'retrievepassword'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'resetpass'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'rp'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'register'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'login'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900; font-weight: bold;">false</span> <span style="color: #339933;">===</span> has_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'login_form_'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$action</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
	<span style="color: #000088;">$action</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'login'</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>接下来转到369行：如下</p>

<div class="wp_codebox"><table><tr id="p41524"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code" id="p415code24"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'resetpass'</span> <span style="color: #339933;">:</span>
<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'rp'</span> <span style="color: #339933;">:</span>
	<span style="color: #000088;">$errors</span> <span style="color: #339933;">=</span> reset_password<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'key'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> is_wp_error<span style="color: #009900;">&#40;</span><span style="color: #000088;">$errors</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		wp_redirect<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp-login.php?checkemail=newpass'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	wp_redirect<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp-login.php?action=lostpassword&amp;error=invalidkey'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

</p>
<h3>3.解决的办法：</h3>
<p>1. 立即升级到2.84版本；</p>
<p>2. 修改wp-login.php文件，将190行的代码，如下：</p>

<div class="wp_codebox"><table><tr id="p41525"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p415code25"><pre class="php" style="font-family:monospace;">	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$key</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">new</span> WP_Error<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'invalid_key'</span><span style="color: #339933;">,</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Invalid key'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>修改为：</p>

<div class="wp_codebox"><table><tr id="p41526"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p415code26"><pre class="php" style="font-family:monospace;">	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$key</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$key</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">new</span> WP_Error<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'invalid_key'</span><span style="color: #339933;">,</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Invalid key'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

</p>
<h3>4. 官方：</h3>
<p>官方更新解决方法：<a href="http://core.trac.wordpress.org/changeset/11798" rel="external">http://core.trac.wordpress.org/changeset/11798</a></p>
<h2  class="related_post_title">你也许会喜欢阅读这些：</h2><ul class="related_post"><li>2009年11月25日 -- <a href="http://www.ihiro.org/wordpress-the-article-automatically-appear-as-two" title="Wordpress:将文章自动显示为两列">Wordpress:将文章自动显示为两列</a> (13)</li><li>2009年09月16日 -- <a href="http://www.ihiro.org/including-wordpress-comment-reply-js" title="Wordpress:正确地引入comment-reply.js文件">Wordpress:正确地引入comment-reply.js文件</a> (23)</li><li>2009年08月31日 -- <a href="http://www.ihiro.org/4-ways-to-display-the-copyrights-of-blog" title="Wordpress:4个常见的显示博客版权的方法">Wordpress:4个常见的显示博客版权的方法</a> (10)</li><li>2009年07月24日 -- <a href="http://www.ihiro.org/display-tags-in-a-dropdown-list-box" title="Wordpress:显示tags在一个下拉列表中">Wordpress:显示tags在一个下拉列表中</a> (8)</li><li>2010年06月3日 -- <a href="http://www.ihiro.org/wordpress-3-new-features" title="Wordpress:3.0版本特性，将改变你的内容管理方式">Wordpress:3.0版本特性，将改变你的内容管理方式</a> (12)</li><li>2010年03月25日 -- <a href="http://www.ihiro.org/the-enhanced-ajax-effect-instructions" title="Ajax:近期博客改版的增强Ajax加载说明">Ajax:近期博客改版的增强Ajax加载说明</a> (43)</li><li>2010年02月20日 -- <a href="http://www.ihiro.org/how-to-insert-googlebuzz-data-into-blog" title="Wordpress:如何将GoogleBuzz数据插入到博客中">Wordpress:如何将GoogleBuzz数据插入到博客中</a> (11)</li><li>2009年11月8日 -- <a href="http://www.ihiro.org/my-third-theme-innernews" title="主题:我的第三个主题innerNews提供下载">主题:我的第三个主题innerNews提供下载</a> (24)</li><li>2009年09月13日 -- <a href="http://www.ihiro.org/wordpress-2-9-version-new-features" title="Wordpress:2.9版本&#8211;新的特性">Wordpress:2.9版本&#8211;新的特性</a> (13)</li><li>2009年09月6日 -- <a href="http://www.ihiro.org/highlight-the-administrators-reply-message" title="Wordpress:高亮管理员的留言信息">Wordpress:高亮管理员的留言信息</a> (37)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ihiro.org/the-reason-of-update-password-reset-loophole/feed</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>主题：我的第一个主题ihiro提供下载了</title>
		<link>http://www.ihiro.org/my-first-theme-for-download</link>
		<comments>http://www.ihiro.org/my-first-theme-for-download#comments</comments>
		<pubDate>Wed, 05 Aug 2009 01:35:05 +0000</pubDate>
		<dc:creator>Hiro</dc:creator>
				<category><![CDATA[原创主题]]></category>
		<category><![CDATA[Theme]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.ihiro.org/?p=345</guid>
		<description><![CDATA[<img src="http://www.ihiro.org/blog/wp-content/themes/ihiro/screenshot.png" class="alignleft" alt="theme-ihiro" width="100" height="75" />
<p>在我的博客6月份上线后，陆续有人向我索要我的主题。当时因为我只有这一个主题的原因，都陆续婉言拒绝了，我跟他们说等我到了8月换了新的主题后就会将旧的主题共享出来的！终于我的新主题于8月4日上线了，相信大家已经看到了。</p>
<p>于是昨晚乎，花了1-2个小时的时间整理了前一个主题的源代码，删除了那些没有的代码。并且整理了一下psd源码，放在了源文件的压缩包里一并共享给大家！</p>]]></description>
			<content:encoded><![CDATA[<p>在我的博客6月份上线后，陆续有人向我索要我的主题。当时因为我只有这一个主题的原因，都陆续婉言拒绝了，我跟他们说等我到了8月换了新的主题后就会将旧的主题共享出来的！终于我的新主题于8月4日上线了，相信大家已经看到了。</p>
<p>于是昨晚乎，花了1-2个小时的时间整理了前一个主题的源代码，删除了那些没有的代码。并且整理了一下psd源码，放在了源文件的压缩包里一并共享给大家！主题效果如图：<img src="http://www.ihiro.org/blog/wp-content/themes/ihiro/screenshot.png" class="aligncenter" alt="theme-ihiro" /></p>
<p class="demo-down-bar"><a href="http://www.ihiro.org/downloads/themes/ihiro.zip" class="download">download</a><a href="http://www.ihiro.org/downloads/ihiro.png" rel="external" class="demo">demo</a></p>
<h3>就该主题我说明的几点：</h3>
<p>1. 该主题主要用到的插件是pageNavi，但因为我在header.php中并没有调用wp_head()函数，所以pageNavi插件的css样式文件无法引入，所以我在style.css文件中对pageNavi进行样式化；</p>
<p>2. 若在源文件中看到_e(”, &#8216;ihiro&#8217;)等之类的函数，不要惊讶，我在该函数后加一个英文参数是为了使输出的结果为英文的；</p>
<p>3. 我通过使用wordpress的条件判断is_xxxx()函数来根据不同情况显示不同内容，将多个文件整合到了index.php文件中，大家在源文件可以看的出来；</p>
<p>4. 我将两个psd的源文件放在压缩包的images下的source文件夹内，并附上logo使用的字体安装文件。</p>
<p>最后，感谢大家一直以来的关注和支持，我会继续努力！</p>
<p style="color:#f00; font:16px blod; text-align:center;">特此向大家道歉：此共享主题并非我现在用的主题，而是我的站点上线时使用的第一个主题，效果见文章的截图或预览页面（因之前的预览链接是我登录后台后，直接使用的外观标签下的预览链接的地址，导致大家预览时没有看到真正的预览效果，现已经更正，抓取了截图）。感谢<a href="http://www.shirakdy.com/" rel="external">shirak</a>的提示，非常感谢！也望大家原谅我之前的粗心！</p>
<h2  class="related_post_title">你也许会喜欢阅读这些：</h2><ul class="related_post"><li>2009年11月8日 -- <a href="http://www.ihiro.org/my-third-theme-innernews" title="主题:我的第三个主题innerNews提供下载">主题:我的第三个主题innerNews提供下载</a> (24)</li><li>2010年06月3日 -- <a href="http://www.ihiro.org/wordpress-3-new-features" title="Wordpress:3.0版本特性，将改变你的内容管理方式">Wordpress:3.0版本特性，将改变你的内容管理方式</a> (12)</li><li>2010年03月25日 -- <a href="http://www.ihiro.org/the-enhanced-ajax-effect-instructions" title="Ajax:近期博客改版的增强Ajax加载说明">Ajax:近期博客改版的增强Ajax加载说明</a> (43)</li><li>2010年02月20日 -- <a href="http://www.ihiro.org/how-to-insert-googlebuzz-data-into-blog" title="Wordpress:如何将GoogleBuzz数据插入到博客中">Wordpress:如何将GoogleBuzz数据插入到博客中</a> (11)</li><li>2009年11月25日 -- <a href="http://www.ihiro.org/wordpress-the-article-automatically-appear-as-two" title="Wordpress:将文章自动显示为两列">Wordpress:将文章自动显示为两列</a> (13)</li><li>2009年09月16日 -- <a href="http://www.ihiro.org/including-wordpress-comment-reply-js" title="Wordpress:正确地引入comment-reply.js文件">Wordpress:正确地引入comment-reply.js文件</a> (23)</li><li>2009年09月13日 -- <a href="http://www.ihiro.org/wordpress-2-9-version-new-features" title="Wordpress:2.9版本&#8211;新的特性">Wordpress:2.9版本&#8211;新的特性</a> (13)</li><li>2009年09月6日 -- <a href="http://www.ihiro.org/highlight-the-administrators-reply-message" title="Wordpress:高亮管理员的留言信息">Wordpress:高亮管理员的留言信息</a> (37)</li><li>2009年08月31日 -- <a href="http://www.ihiro.org/4-ways-to-display-the-copyrights-of-blog" title="Wordpress:4个常见的显示博客版权的方法">Wordpress:4个常见的显示博客版权的方法</a> (10)</li><li>2009年08月13日 -- <a href="http://www.ihiro.org/the-reason-of-update-password-reset-loophole" title="Wordpress:最新2.84更新的原因：密码重置漏洞（图文教程解决）">Wordpress:最新2.84更新的原因：密码重置漏洞（图文教程解决）</a> (15)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ihiro.org/my-first-theme-for-download/feed</wfw:commentRss>
		<slash:comments>101</slash:comments>
		</item>
		<item>
		<title>WordPress:显示你的博客数据库查询次数和查询花费时间</title>
		<link>http://www.ihiro.org/show-queries-and-times</link>
		<comments>http://www.ihiro.org/show-queries-and-times#comments</comments>
		<pubDate>Tue, 04 Aug 2009 08:53:40 +0000</pubDate>
		<dc:creator>Hiro</dc:creator>
				<category><![CDATA[Hack技巧]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.ihiro.org/?p=338</guid>
		<description><![CDATA[<img src="http://www.ihiro.org/blog/wp-content/uploads/2009/08/query.jpg" alt="query" title="query" width="100" height="100" class="alignleft wp-image-339" />
<p>Wordpress提供了一些功能函数可以轻松地显示数据库查询的统计信息，这些信息可以公开地显示在网页中，或者隐藏在源代码中，更或者只有你自己可以看到。Wordpress主要提供了两个统计函数：
<br />
1.网页加载时查询数据库的次数:&#60;?php echo get_num_queries(); ?&#62;<br />
2.服务器端完成这些查询所花费的时间:&#60;?php timer_stop(7); ?&#62;</p>
<p>结果显示效果：29 queries in 0.431 seconds</p>]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.ihiro.org/blog/wp-content/uploads/2009/08/query.jpg" alt="query" title="query" width="150" height="150" class="alignright size-full wp-image-339" /></p>
<p>WordPress提供了一些功能函数可以轻松地显示数据库查询的统计信息，这些信息可以公开地显示在网页中，或者隐藏在源代码中，更或者只有你自己可以看到。Wordpress主要提供了两个统计函数：<br />
<br />
1.网页加载时查询数据库的次数:&lt;?php echo get_num_queries(); ?&gt;<br />
2.服务器端完成这些查询所花费的时间:&lt;?php timer_stop(7); ?&gt;</p>
<p>可以使用3种方式在网页中显示:</p>
<h3>1. 公开地显示查询的统计信息：</h3>
<p>如果你觉的你的服务器或空间的处理速度好，或者想让你的访问者看到这些查询统计信息的话，你可以将这些统计信息公开显示在页面中：（效果查看博客的页面底部）</p>

<div class="wp_codebox"><table><tr id="p33827"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p338code27"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>p<span style="color: #339933;">&gt;&lt;</span> ?php <span style="color: #b1b100;">echo</span> get_num_queries<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> queries in <span style="color: #339933;">&lt;</span> ?php timer_stop<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> seconds<span style="color: #339933;">&lt;/</span>p<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<h3>2. 将统计信息显示在源代码中，而不出现页面的内容中：</h3>
<p>如果你不想将统计信息显示在页面上供访问者查看，但又想自己可以知道这些统计信息，那么你可以通过html的注释将结果只显示在源代码中（PS：大家也可以从源代码中查看的哦！）：</p>

<div class="wp_codebox"><table><tr id="p33828"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p338code28"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;!--</span> <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> get_num_queries<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> queries in <span style="color: #339933;">&lt;</span> ?php timer_stop<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> seconds <span style="color: #339933;">--&gt;</span></pre></td></tr></table></div>

<h3>3. 统计信息只有你自己登录了后可以看到：</h3>
<p>该方法是第二种显示的优化方法，只需博客管理员登录后就可以查看查询统计信息，访问者是无法查看的：</p>

<div class="wp_codebox"><table><tr id="p33829"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p338code29"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>current_user_can<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'level_10'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;!-- '</span> <span style="color: #339933;">.</span> get_num_queries<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' queries in '</span> <span style="color: #339933;">.</span> timer_stop<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' seconds --&gt;'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>查询结果显示的效果可以观测我博客的底部。</p>
<h2  class="related_post_title">你也许会喜欢阅读这些：</h2><ul class="related_post"><li>2010年06月3日 -- <a href="http://www.ihiro.org/wordpress-3-new-features" title="Wordpress:3.0版本特性，将改变你的内容管理方式">Wordpress:3.0版本特性，将改变你的内容管理方式</a> (12)</li><li>2010年03月25日 -- <a href="http://www.ihiro.org/the-enhanced-ajax-effect-instructions" title="Ajax:近期博客改版的增强Ajax加载说明">Ajax:近期博客改版的增强Ajax加载说明</a> (43)</li><li>2010年02月20日 -- <a href="http://www.ihiro.org/how-to-insert-googlebuzz-data-into-blog" title="Wordpress:如何将GoogleBuzz数据插入到博客中">Wordpress:如何将GoogleBuzz数据插入到博客中</a> (11)</li><li>2009年11月25日 -- <a href="http://www.ihiro.org/wordpress-the-article-automatically-appear-as-two" title="Wordpress:将文章自动显示为两列">Wordpress:将文章自动显示为两列</a> (13)</li><li>2009年11月8日 -- <a href="http://www.ihiro.org/my-third-theme-innernews" title="主题:我的第三个主题innerNews提供下载">主题:我的第三个主题innerNews提供下载</a> (24)</li><li>2009年09月16日 -- <a href="http://www.ihiro.org/including-wordpress-comment-reply-js" title="Wordpress:正确地引入comment-reply.js文件">Wordpress:正确地引入comment-reply.js文件</a> (23)</li><li>2009年09月13日 -- <a href="http://www.ihiro.org/wordpress-2-9-version-new-features" title="Wordpress:2.9版本&#8211;新的特性">Wordpress:2.9版本&#8211;新的特性</a> (13)</li><li>2009年09月6日 -- <a href="http://www.ihiro.org/highlight-the-administrators-reply-message" title="Wordpress:高亮管理员的留言信息">Wordpress:高亮管理员的留言信息</a> (37)</li><li>2009年08月31日 -- <a href="http://www.ihiro.org/4-ways-to-display-the-copyrights-of-blog" title="Wordpress:4个常见的显示博客版权的方法">Wordpress:4个常见的显示博客版权的方法</a> (10)</li><li>2009年08月13日 -- <a href="http://www.ihiro.org/the-reason-of-update-password-reset-loophole" title="Wordpress:最新2.84更新的原因：密码重置漏洞（图文教程解决）">Wordpress:最新2.84更新的原因：密码重置漏洞（图文教程解决）</a> (15)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ihiro.org/show-queries-and-times/feed</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>WordPress:如何去除wp中的版本信息</title>
		<link>http://www.ihiro.org/how-to-remove-the-version-information-in-wordpress</link>
		<comments>http://www.ihiro.org/how-to-remove-the-version-information-in-wordpress#comments</comments>
		<pubDate>Thu, 30 Jul 2009 01:47:45 +0000</pubDate>
		<dc:creator>Hiro</dc:creator>
				<category><![CDATA[Hack技巧]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[学习笔记]]></category>

		<guid isPermaLink="false">http://www.ihiro.org/?p=294</guid>
		<description><![CDATA[<img src="http://diggingintowordpress.com/wp-content/blog-images/wp-head-thumb.jpg" width="100" height="100" class="alignleft" />
<p>在wp博客中，有一个常见的安全技巧是：不要在你的wp中显示出你的版本信息。许多开发者或者使用者都常常将wp的版本信息显示了出来，但这样可能会被一些人利用该版本的漏洞对你的博客进行攻击。很多人对此比较模糊，这样可能就会给你的博客带来安全性的问题。</p>
<p>那么如何去除wordpress的版本信息以保证博客的安全呢，方法有三：</p>
<h3>1. 最暴力的方法; 2. 比较好的方法; 3. 正确的方法。</h3>]]></description>
			<content:encoded><![CDATA[<p><img src="http://diggingintowordpress.com/wp-content/blog-images/wp-head-thumb.jpg" width="150" height="150" class="alignright" /></p>
<p>在wp博客中，有一个常见的安全技巧是：不要在你的wp中显示出你的版本信息。许多开发者或者使用者都常常将wp的版本信息显示了出来，但这样可能会被一些人利用该版本的漏洞对你的博客进行攻击。很多人对此比较模糊，这样可能就会给你的博客带来安全性的问题。</p>
<p>默认情况下，当wp_head() 函数在header.php文件的head标签中被调用时wordpress就执行了wp_generator()，wp_head()函数所处位置如图：<img src="http://diggingintowordpress.com/wp-content/blog-images/wp-head-screens.gif" width="582" height="303" class="aligncenter" />
</p>
<p>当wordpress在网页中运行时，wp_generator()函数输出如下内容（可以在页面源代码中查看到）：</p>

<div class="wp_codebox"><table><tr id="p29430"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p294code30"><pre class="html" style="font-family:monospace;">&lt;meta name=&quot;generator&quot; content=&quot;WordPress 2.8.1&quot; /&gt;</pre></td></tr></table></div>

</p>
<p>那么如何去除wordpress的版本信息以保证博客的安全呢，方法有三：</p>
<h3>1. 最暴力的方法：</h3>
<p>直接删除header.php文件中的wp_head()函数（我当前主题就是采用的这种方法）；</p>
<h3>2. 比较好的方法:</h3>
<p>比删除wp_head()函数更好的方法是在function.php文件中添加一个功能函数，通过返回一个空白的字符串给the_generator()函数，这样输出的版本信息将为空，代码如下：</p>

<div class="wp_codebox"><table><tr id="p29431"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p294code31"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> remove_version_info<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'the_generator'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'remove_version_info'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

</p>
<h3>3. 正确的方法：</h3>
<p>
只需在function.php文件中添加41个字符的代码，即可实现,它是通过remove_action()函数删除了wp_head()函数中的wp_generator()函数，代码如下：</p>

<div class="wp_codebox"><table><tr id="p29432"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p294code32"><pre class="php" style="font-family:monospace;">remove_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp_head'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wp_generator'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

</p>
<p>题外话：remove_action()函数的功能很多、很强大，以后遇到会再讲解！</p></p>
<h2  class="related_post_title">你也许会喜欢阅读这些：</h2><ul class="related_post"><li>2009年11月25日 -- <a href="http://www.ihiro.org/wordpress-the-article-automatically-appear-as-two" title="Wordpress:将文章自动显示为两列">Wordpress:将文章自动显示为两列</a> (13)</li><li>2009年07月24日 -- <a href="http://www.ihiro.org/display-tags-in-a-dropdown-list-box" title="Wordpress:显示tags在一个下拉列表中">Wordpress:显示tags在一个下拉列表中</a> (8)</li><li>2009年07月22日 -- <a href="http://www.ihiro.org/2-wp-tips" title="Wordpress:两个wp的小技巧，非常实用哦！">Wordpress:两个wp的小技巧，非常实用哦！</a> (12)</li><li>2009年07月20日 -- <a href="http://www.ihiro.org/custom-and-configure-a-single-page-template" title="Wordpress:自定义单页模板的制作和配置">Wordpress:自定义单页模板的制作和配置</a> (20)</li><li>2009年06月18日 -- <a href="http://www.ihiro.org/wordpress-study-notes-url-settings" title="WordPress学习笔记&#8211;url设置">WordPress学习笔记&#8211;url设置</a> (8)</li><li>2011年04月20日 -- <a href="http://www.ihiro.org/css3-transition" title="CSS3:Transition属性详解">CSS3:Transition属性详解</a> (82)</li><li>2011年04月1日 -- <a href="http://www.ihiro.org/html5-reading-note-chp4-canvas" title="HTML5:《HTML5. Up and Running》读书笔记.Chp4.Canvas">HTML5:《HTML5. Up and Running》读书笔记.Chp4.Canvas</a> (22)</li><li>2011年03月21日 -- <a href="http://www.ihiro.org/html5-reading-note-chp3-elements" title="HTML5:《HTML5. Up and Running》读书笔记.Chp3.Elements">HTML5:《HTML5. Up and Running》读书笔记.Chp3.Elements</a> (24)</li><li>2011年03月15日 -- <a href="http://www.ihiro.org/html5-reading-note-chp2-features" title="HTML5:《HTML5. Up and Running》读书笔记.Chp2.Features">HTML5:《HTML5. Up and Running》读书笔记.Chp2.Features</a> (23)</li><li>2010年11月22日 -- <a href="http://www.ihiro.org/text-range" title="Range:文本框选区学习笔记">Range:文本框选区学习笔记</a> (16)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ihiro.org/how-to-remove-the-version-information-in-wordpress/feed</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>WordPress:显示tags在一个下拉列表中</title>
		<link>http://www.ihiro.org/display-tags-in-a-dropdown-list-box</link>
		<comments>http://www.ihiro.org/display-tags-in-a-dropdown-list-box#comments</comments>
		<pubDate>Fri, 24 Jul 2009 07:23:10 +0000</pubDate>
		<dc:creator>Hiro</dc:creator>
				<category><![CDATA[Hack技巧]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[学习笔记]]></category>

		<guid isPermaLink="false">http://www.ihiro.org/?p=271</guid>
		<description><![CDATA[<img src="http://www.wprecipes.com/wp-content/uploads/2009/06/tags1.jpg" width="100" height="100" class="alignleft" />
<p>标签(tags)在博客中很实用，每个博客中都有一个标签列表或标签云。你若只有几十个标签的话，页面看起来还是比较好的，但若你有上百个标签的话，那么你的标签将会变得非常难看和难读。这样对你的读者不友好，不便于他们查找。</p><p>现在很多的博客上的标签都是以a标签内联显示或者漂亮点的标签使用li标签制作成一个列表显示，另外就是利用插件动态地falsh显示。用a标签内联显示时若设置wp_tag_cloud()的smallest和largest参数值不相等，那么这个标签云显示的就比较丑陋的；而用li标签显示上百个标签的话，会占据很大的页面，不友好；而使用插件flash动态显示确实很美观，但加载速度明显降低，而且会出现不同浏览器层次的bug。若刚好这个flash标签云的上方刚好有个鼠标移动上去的下拉菜单，说不定在不同的浏览器下，有的是现实在flash上层，有的却是跑到了flash的下面去了。这个现象很常见哦！</p>
<p>今天在国外的网站上看到了这个解决方案，觉得很是不错，它将标签显示在一个下拉列表框中，这样既不占据很大的页面，经css美化的话显示器来也很不错哦！</p>]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.wprecipes.com/wp-content/uploads/2009/06/tags1.jpg" width="200" height="200" class="alignright" />标签(tags)在博客中很实用，每个博客中都有一个标签列表或标签云。你若只有几十个标签的话，页面看起来还是比较好的，但若你有上百个标签的话，那么你的标签将会变得非常难看和难读。这样对你的读者不友好，不便于他们查找。</p>
<p>现在很多的博客上的标签都是以a标签内联显示或者漂亮点的标签使用li标签制作成一个列表显示，另外就是利用插件动态地falsh显示。用a标签内联显示时若设置wp_tag_cloud()的smallest和largest参数值不相等，那么这个标签云显示的就比较丑陋的；而用li标签显示上百个标签的话，会占据很大的页面，不友好；而使用插件flash动态显示确实很美观，但加载速度明显降低，而且会出现不同浏览器层次的bug。若刚好这个flash标签云的上方刚好有个鼠标移动上去的下拉菜单，说不定在不同的浏览器下，有的是现实在flash上层，有的却是跑到了flash的下面去了。这个现象很常见哦！</p>
<p>今天在国外的网站上看到了这个解决方案，觉得很是不错，它将标签显示在一个下拉列表框中，这样既不占据很大的页面，经css美化的话显示器来也很不错哦！</p>
<h3>步骤一：添加功能函数到function.php文件中，具体代码如下：</h3>

<div class="wp_codebox"><table><tr id="p27133"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
</pre></td><td class="code" id="p271code33"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php
<span style="color: #000000; font-weight: bold;">function</span> dropdown_tag_cloud<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$args</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$defaults</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'smallest'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">8</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'largest'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">22</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'unit'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'pt'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'number'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">45</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'format'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'flat'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'orderby'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'name'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'order'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'ASC'</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'exclude'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'include'</span> <span style="color: #339933;">=&amp;</span>gt<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;">$args</span> <span style="color: #339933;">=</span> wp_parse_args<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$args</span><span style="color: #339933;">,</span> <span style="color: #000088;">$defaults</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$tags</span> <span style="color: #339933;">=</span> get_tags<span style="color: #009900;">&#40;</span> <span style="color: #990000;">array_merge</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$args</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'orderby'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'count'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'order'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'DESC'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Always query top tags</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tags</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
		<span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$return</span> <span style="color: #339933;">=</span> dropdown_generate_tag_cloud<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$tags</span><span style="color: #339933;">,</span> <span style="color: #000088;">$args</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Here's where those top tags get sorted according to $args</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> is_wp_error<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$return</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">else</span>
		<span style="color: #b1b100;">echo</span> apply_filters<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'dropdown_tag_cloud'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$return</span><span style="color: #339933;">,</span> <span style="color: #000088;">$args</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> dropdown_generate_tag_cloud<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$tags</span><span style="color: #339933;">,</span> <span style="color: #000088;">$args</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wp_rewrite</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$defaults</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'smallest'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">8</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'largest'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">22</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'unit'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'pt'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'number'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">45</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'format'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'flat'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'orderby'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'name'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'order'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'ASC'</span>
	<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$args</span> <span style="color: #339933;">=</span> wp_parse_args<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$args</span><span style="color: #339933;">,</span> <span style="color: #000088;">$defaults</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">extract</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$args</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #000088;">$tags</span> <span style="color: #009900;">&#41;</span>
		<span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$counts</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$tag_links</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</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: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$tags</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$tag</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$counts</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$tag</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>name<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$tag</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>count<span style="color: #339933;">;</span>
		<span style="color: #000088;">$tag_links</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$tag</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>name<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> get_tag_link<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$tag</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>term_id <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> is_wp_error<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$tag_links</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$tag</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>name<span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #000088;">$tag_links</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$tag</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>name<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$tag_ids</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$tag</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>name<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$tag</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>term_id<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000088;">$min_count</span> <span style="color: #339933;">=</span> <span style="color: #990000;">min</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$counts</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$spread</span> <span style="color: #339933;">=</span> <span style="color: #990000;">max</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$counts</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$min_count</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$spread</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;=</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span>
		<span style="color: #000088;">$spread</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$font_spread</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$largest</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$smallest</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$font_spread</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;=</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span>
		<span style="color: #000088;">$font_spread</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$font_step</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$font_spread</span> <span style="color: #339933;">/</span> <span style="color: #000088;">$spread</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// SQL cannot save you; this is a second (potentially different) sort on a subset of data.</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'name'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$orderby</span> <span style="color: #009900;">&#41;</span>
		<span style="color: #990000;">uksort</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$counts</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'strnatcasecmp'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">else</span>
		<span style="color: #990000;">asort</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$counts</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'DESC'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$order</span> <span style="color: #009900;">&#41;</span>
		<span style="color: #000088;">$counts</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_reverse</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$counts</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$a</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$rel</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">is_object</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$wp_rewrite</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> <span style="color: #000088;">$wp_rewrite</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>using_permalinks<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> ? <span style="color: #0000ff;">' rel=&quot;tag&quot;'</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$counts</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$tag</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #000088;">$count</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$tag_id</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$tag_ids</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$tag</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$tag_link</span> <span style="color: #339933;">=</span> clean_url<span style="color: #009900;">&#40;</span><span style="color: #000088;">$tag_links</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$tag</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$tag</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&amp;nbsp;'</span><span style="color: #339933;">,</span> wp_specialchars<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$tag</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$a</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&amp;lt;option value='<span style="color: #006699; font-weight: bold;">$tag_link</span>'&amp;gt;<span style="color: #006699; font-weight: bold;">$tag</span> (<span style="color: #006699; font-weight: bold;">$count</span>)&amp;lt;/option&amp;gt;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #b1b100;">switch</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$format</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span>
	<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'array'</span> <span style="color: #339933;">:</span>
		<span style="color: #000088;">$return</span> <span style="color: #339933;">=&amp;</span> <span style="color: #000088;">$a</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'list'</span> <span style="color: #339933;">:</span>
		<span style="color: #000088;">$return</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&amp;lt;ul class='wp-tag-cloud'&amp;gt;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span>&amp;lt;li&amp;gt;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$return</span> <span style="color: #339933;">.=</span> <span style="color: #990000;">join</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&amp;lt;/li&amp;gt;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span>&amp;lt;li&amp;gt;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$a</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$return</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&amp;lt;/li&amp;gt;<span style="color: #000099; font-weight: bold;">\n</span>&amp;lt;/ul&amp;gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">default</span> <span style="color: #339933;">:</span>
		<span style="color: #000088;">$return</span> <span style="color: #339933;">=</span> <span style="color: #990000;">join</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$a</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">endswitch</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> apply_filters<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'dropdown_generate_tag_cloud'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$return</span><span style="color: #339933;">,</span> <span style="color: #000088;">$tags</span><span style="color: #339933;">,</span> <span style="color: #000088;">$args</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></pre></td></tr></table></div>

<h3>步骤二：安放下拉列表框的代码，调用功能函数</h3>
<p>完成上面的步骤后，只需要在你需要安放下拉列表框的地方调用该功能函数即可（通常会放在siderbar.php文件中）。在其中放入如下代码</p>
<p>
<div class="wp_codebox"><table><tr id="p27134"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p271code34"><pre class="html" style="font-family:monospace;">&lt;select name=&quot;tag-dropdown&quot; onchange=&quot;document.location.href=this.options[this.selectedIndex].value;&quot;&gt;
	&lt;option value=&quot;#&quot;&gt;Liste d'auteurs&lt;/option&gt;
	&lt; ?php dropdown_tag_cloud('number=0&amp;order=asc'); ?&gt;
&lt;/select&gt;</pre></td></tr></table></div>

</p>
<p>那么这样子你就有了一个下拉列表的标签，这样阅读起来更加友好吧。当然自己可以针对该列表框使用css美化哦！</p>
<h2  class="related_post_title">你也许会喜欢阅读这些：</h2><ul class="related_post"><li>2009年11月25日 -- <a href="http://www.ihiro.org/wordpress-the-article-automatically-appear-as-two" title="Wordpress:将文章自动显示为两列">Wordpress:将文章自动显示为两列</a> (13)</li><li>2009年09月16日 -- <a href="http://www.ihiro.org/including-wordpress-comment-reply-js" title="Wordpress:正确地引入comment-reply.js文件">Wordpress:正确地引入comment-reply.js文件</a> (23)</li><li>2009年08月31日 -- <a href="http://www.ihiro.org/4-ways-to-display-the-copyrights-of-blog" title="Wordpress:4个常见的显示博客版权的方法">Wordpress:4个常见的显示博客版权的方法</a> (10)</li><li>2009年08月13日 -- <a href="http://www.ihiro.org/the-reason-of-update-password-reset-loophole" title="Wordpress:最新2.84更新的原因：密码重置漏洞（图文教程解决）">Wordpress:最新2.84更新的原因：密码重置漏洞（图文教程解决）</a> (15)</li><li>2009年07月30日 -- <a href="http://www.ihiro.org/how-to-remove-the-version-information-in-wordpress" title="Wordpress:如何去除wp中的版本信息">Wordpress:如何去除wp中的版本信息</a> (16)</li><li>2009年07月22日 -- <a href="http://www.ihiro.org/2-wp-tips" title="Wordpress:两个wp的小技巧，非常实用哦！">Wordpress:两个wp的小技巧，非常实用哦！</a> (12)</li><li>2009年07月20日 -- <a href="http://www.ihiro.org/custom-and-configure-a-single-page-template" title="Wordpress:自定义单页模板的制作和配置">Wordpress:自定义单页模板的制作和配置</a> (20)</li><li>2009年06月18日 -- <a href="http://www.ihiro.org/wordpress-study-notes-url-settings" title="WordPress学习笔记&#8211;url设置">WordPress学习笔记&#8211;url设置</a> (8)</li><li>2011年04月20日 -- <a href="http://www.ihiro.org/css3-transition" title="CSS3:Transition属性详解">CSS3:Transition属性详解</a> (82)</li><li>2011年04月1日 -- <a href="http://www.ihiro.org/html5-reading-note-chp4-canvas" title="HTML5:《HTML5. Up and Running》读书笔记.Chp4.Canvas">HTML5:《HTML5. Up and Running》读书笔记.Chp4.Canvas</a> (22)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ihiro.org/display-tags-in-a-dropdown-list-box/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>WordPress:两个wp的小技巧，非常实用哦！</title>
		<link>http://www.ihiro.org/2-wp-tips</link>
		<comments>http://www.ihiro.org/2-wp-tips#comments</comments>
		<pubDate>Wed, 22 Jul 2009 09:06:23 +0000</pubDate>
		<dc:creator>Hiro</dc:creator>
				<category><![CDATA[Hack技巧]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[学习笔记]]></category>

		<guid isPermaLink="false">http://www.ihiro.org/?p=265</guid>
		<description><![CDATA[<p><img src="http://www.ihiro.org/blog/wp-content/uploads/2009/07/welcome.png" alt="wp" title="wp" width="100" height="100" class="alignleft wp-image-266" />最近比较喜欢到处去逛一些国外的博客，经常会看到一些非常实用的技巧。选择了两个收集来的技巧与大家分享一下。</p>
<h3>一、 使用wp_enqueue_script()函数调用wp内部的js：</h3>
<p>1. 调用jQuery库; 2. 调用comment-reply.js.</p>
<h3>二、动态的版权年限.</h3>]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.ihiro.org/blog/wp-content/uploads/2009/07/welcome.png" alt="wp" title="wp" width="150" height="150" class="alignright wp-image-266" /><br />
最近比较喜欢到处去逛一些国外的博客，经常会看到一些非常实用的技巧。选择了两个收集来的技巧与大家分享一下。</p>
<h3>一、 使用wp_enqueue_script()函数调用wp内部的js：</h3>
<p><strong>1. 调用jQuery库：</strong><br />
使用方法：在head标签间添加代码，如下：</p>

<div class="wp_codebox"><table><tr id="p26535"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p265code35"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php wp_enqueue_script<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;jquery&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>优点：主题模板会自动调用wp博客系统中的jQuery库，比自主加载的速度要快，而且随着wp系统的升级，主题的jQuery库的版本与系统的jQuery库版本相同；<br />
缺点：一直提倡将js文件在页面的底部引入（也就是放在footer.php文件中），这样会使页面显示的速度加快，但使用wp_enqueue_script()函数调用wp系统的jQuery库是不能放在footer.php中的，放在底部将调用不到wp系统的jQuery库。而且此时jQuery的$()简写方法将会失效，此时你可以使用原始的jQuery()方法或使用如下方法简写：</p>

<div class="wp_codebox"><table><tr id="p26536"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code" id="p265code36"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> $j <span style="color: #339933;">=</span> jQuery.<span style="color: #660066;">noConflict</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
$j<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>
&nbsp;
    $j<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#sidebar li a&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hover</span><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>
    	$j<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">animate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
    		paddingLeft<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;20px&amp;&quot;</span>
    	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">400</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</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>
    	$j<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">animate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
    		paddingLeft<span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span>
    	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">400</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

</p>
<p><strong>2. 调用comment-reply.js：</strong><br />
使用方法：在head标签间添加代码，如下：</p>

<div class="wp_codebox"><table><tr id="p26537"><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code" id="p265code37"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php <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: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
	wp_enqueue_script<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'comment-reply'</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></pre></td></tr></table></div>

<p>因为comment-reply.js只有在单页的时候才会使用，所以需判断当前页是否为single，是则加载，否则无须加载。
</p>
<p style="color:#f00;">注意：wp_enqueue_script()必须放在&lt;?php wp_head(); ?&gt;之前。</p>
<h3>二、动态的版权年限：</h3>
<p>我们一般在输入版权信息的年限时，都是手动输入，但如使用date(“Y”);方法就可以根据服务器的时间显示版权年限，无需每年都要手动修改。如：</p>

<div class="wp_codebox"><table><tr id="p26538"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p265code38"><pre class="php" style="font-family:monospace;">Copyright <span style="color: #339933;">&amp;</span>copy<span style="color: #339933;">;</span> <span style="color: #339933;">&lt;</span> ?php <span style="color: #b1b100;">echo</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Y&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>
</p>
<h2  class="related_post_title">你也许会喜欢阅读这些：</h2><ul class="related_post"><li>2009年11月25日 -- <a href="http://www.ihiro.org/wordpress-the-article-automatically-appear-as-two" title="Wordpress:将文章自动显示为两列">Wordpress:将文章自动显示为两列</a> (13)</li><li>2009年07月30日 -- <a href="http://www.ihiro.org/how-to-remove-the-version-information-in-wordpress" title="Wordpress:如何去除wp中的版本信息">Wordpress:如何去除wp中的版本信息</a> (16)</li><li>2009年07月24日 -- <a href="http://www.ihiro.org/display-tags-in-a-dropdown-list-box" title="Wordpress:显示tags在一个下拉列表中">Wordpress:显示tags在一个下拉列表中</a> (8)</li><li>2009年07月20日 -- <a href="http://www.ihiro.org/custom-and-configure-a-single-page-template" title="Wordpress:自定义单页模板的制作和配置">Wordpress:自定义单页模板的制作和配置</a> (20)</li><li>2009年06月18日 -- <a href="http://www.ihiro.org/wordpress-study-notes-url-settings" title="WordPress学习笔记&#8211;url设置">WordPress学习笔记&#8211;url设置</a> (8)</li><li>2011年04月20日 -- <a href="http://www.ihiro.org/css3-transition" title="CSS3:Transition属性详解">CSS3:Transition属性详解</a> (82)</li><li>2011年04月1日 -- <a href="http://www.ihiro.org/html5-reading-note-chp4-canvas" title="HTML5:《HTML5. Up and Running》读书笔记.Chp4.Canvas">HTML5:《HTML5. Up and Running》读书笔记.Chp4.Canvas</a> (22)</li><li>2011年03月21日 -- <a href="http://www.ihiro.org/html5-reading-note-chp3-elements" title="HTML5:《HTML5. Up and Running》读书笔记.Chp3.Elements">HTML5:《HTML5. Up and Running》读书笔记.Chp3.Elements</a> (24)</li><li>2011年03月15日 -- <a href="http://www.ihiro.org/html5-reading-note-chp2-features" title="HTML5:《HTML5. Up and Running》读书笔记.Chp2.Features">HTML5:《HTML5. Up and Running》读书笔记.Chp2.Features</a> (23)</li><li>2010年11月22日 -- <a href="http://www.ihiro.org/text-range" title="Range:文本框选区学习笔记">Range:文本框选区学习笔记</a> (16)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ihiro.org/2-wp-tips/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>WordPress:自定义单页模板的制作和配置</title>
		<link>http://www.ihiro.org/custom-and-configure-a-single-page-template</link>
		<comments>http://www.ihiro.org/custom-and-configure-a-single-page-template#comments</comments>
		<pubDate>Mon, 20 Jul 2009 09:05:40 +0000</pubDate>
		<dc:creator>Hiro</dc:creator>
				<category><![CDATA[Hack技巧]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[学习笔记]]></category>

		<guid isPermaLink="false">http://www.ihiro.org/?p=245</guid>
		<description><![CDATA[<img src="http://edblog.net/wp-content/uploads/2006/12/wordpress.jpg" width="100" height="100" class="alignleft" />
<p>最近一直在利用闲暇的时间在做自己的第二个主题。在此过程中，重新认识到很多在第一个主题中没有用到的技术。可以说我的第一个主题（现在你们看到的）的结构是相对简单的，用了点css和js的代码实现起来非常容易。但我的第二个主题（CMS风格）的机构将会复杂点，加上我并不急着更换现在的主题，所以我不准备很快发布第二个主题。其实该主题还在建设中，服务器端的代码将近完成，css部分也完成了布局。现在就剩下局部细化和js控制。但我还是不准备很快就更换现在的主题，计划在下月的4号（博客上线1月半纪念）或19号（博客上线2月纪念）的时候再发布。</p>
<p>也正是因为在制作第二个模板，所以学到了很多知识，今天就和大家分享一下自定义单页模板制作和配置的过程。</p>]]></description>
			<content:encoded><![CDATA[<p><img src="http://edblog.net/wp-content/uploads/2006/12/wordpress.jpg" width="150" height="150" class="alignright" /></p>
<h3>开篇语：</h3>
<p>最近一直在利用闲暇的时间在做自己的第二个主题。在此过程中，重新认识到很多在第一个主题中没有用到的技术。可以说我的第一个主题（现在你们看到的）的结构是相对简单的，用了点css和js的代码实现起来非常容易。但我的第二个主题（CMS风格）的机构将会复杂点，加上我并不急着更换现在的主题，所以我不准备很快发布第二个主题。其实该主题还在建设中，服务器端的代码将近完成，css部分也完成了布局。现在就剩下局部细化和js控制。但我还是不准备很快就更换现在的主题，计划在下月的4号（博客上线1月半纪念）或19号（博客上线2月纪念）的时候再发布。</p>
<p>也正是因为在制作第二个模板，所以学到了很多知识，今天就和大家分享一下自定义单页模板制作和配置的过程。</p>
<h3>举例：留言本</h3>
<p>你也许看到有很多的博客上有一个单页的留言本而感到羡慕吧，我也是。我一直想要有个单页的留言本，于是我在wp的官网或其他主题收集网站上下载主题包，查看源文件，但都没有发现我需要的内容。直到今天我知道了自定义单页模板的制作原理后才知道原来很多主题中都有着自定义单页的，只是我当时不知道如何去配置而已。</p>
<p><strong>步骤1：</strong>源文件的创建<br />
建立一个文件guestbook.php或可以另存comments.php为该文件，在文件的开始处添加模板注释（一定要添加，因为WP应通过该注释确认你是一个模板文件的，这和style.css文件的原理一样。）。注释代码如下：</p>

<div class="wp_codebox"><table><tr id="p24539"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p245code39"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php
<span style="color: #666666; font-style: italic;">/*
Template Name: guestbook
*/</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>删除comments.php文件中的多余代码，精简后的源代码如下（该源代码中部分标签是为了我的博客的css编写而添加的，你可以自主地删除和添加）：</p>

<div class="wp_codebox"><table><tr id="p24540"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
</pre></td><td class="code" id="p245code40"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php get_header<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>
     <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;content&quot;</span><span style="color: #339933;">&gt;</span>     
&nbsp;
        <span style="color: #339933;">&lt;!--</span> 左侧 开始 <span style="color: #339933;">--&gt;</span>
        <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;con-left&quot;</span><span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;entry&quot;</span><span style="color: #339933;">&gt;</span>
                <span style="color: #339933;">&lt;</span> ?php <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
                    <span style="color: #339933;">&lt;</span> ?php <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span>have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> the_post<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>
            		<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;post&quot;</span><span style="color: #339933;">&gt;</span>
                        <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;post-top&quot;</span><span style="color: #339933;">&gt;&lt;/</span>div<span style="color: #339933;">&gt;</span>
                        <span style="color: #339933;">&lt;!--</span>
                        	你可以自主添加的其他内容
                         <span style="color: #339933;">--&gt;</span>
                        <span style="color: #339933;">&lt;</span>div<span style="color: #339933;">&gt;</span>    
                            <span style="color: #339933;">&lt;</span> ?php comments_template<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>
                        <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
                        <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;post-btm&quot;</span><span style="color: #339933;">&gt;&lt;/</span>div<span style="color: #339933;">&gt;</span>
                	<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
                    <span style="color: #339933;">&lt;</span> ?php <span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
                <span style="color: #339933;">&lt;</span> ?php <span style="color: #b1b100;">else</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
                    <span style="color: #339933;">&lt;!--</span> 无文章提示 <span style="color: #339933;">--&gt;</span>
                    <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;post&quot;</span><span style="color: #339933;">&gt;</span>
                        <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;post-top&quot;</span><span style="color: #339933;">&gt;&lt;/</span>div<span style="color: #339933;">&gt;</span>
                        <span style="color: #339933;">&lt;</span>h2 <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;aligncenter search&quot;</span><span style="color: #339933;">&gt;</span>抱歉<span style="color: #339933;">,</span>没有找到合适的页面<span style="color: #339933;">.&lt;/</span>h2<span style="color: #339933;">&gt;</span>
                        <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;aligncenter&quot;</span><span style="color: #339933;">&gt;</span>请您<span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php echo get_settings('home'); ?&gt;&quot;</span><span style="color: #339933;">&gt;</span>返回首页<span style="color: #339933;">&lt;</span> ?php <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$langblog</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span>或在搜索中查找您所需的信息<span style="color: #339933;">.</span>带来不便<span style="color: #339933;">,</span>敬请谅解<span style="color: #339933;">!&lt;/</span>div<span style="color: #339933;">&gt;</span>
                        <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;post-btm&quot;</span><span style="color: #339933;">&gt;&lt;/</span>div<span style="color: #339933;">&gt;</span>
                    <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
                <span style="color: #339933;">&lt;</span> ?php <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
            <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
            <span style="color: #339933;">&lt;!--</span> 今日更新 结束 <span style="color: #339933;">--&gt;</span>
        <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
        <span style="color: #339933;">&lt;!--</span> 左侧 结束 <span style="color: #339933;">--&gt;</span>
&nbsp;
        <span style="color: #339933;">&lt;!--</span> 右侧 开始 <span style="color: #339933;">--&gt;</span>
        <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;con-right&quot;</span><span style="color: #339933;">&gt;</span>
            <span style="color: #339933;">&lt;</span> ?php <span style="color: #b1b100;">include</span> <span style="color: #009900;">&#40;</span>TEMPLATEPATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/sidebar.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
        <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
        <span style="color: #339933;">&lt;!--</span> 右侧 结束 <span style="color: #339933;">--&gt;</span>
     <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span> ?php get_footer<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></pre></td></tr></table></div>

<p>css编写部分省略&#8230;..
</p>
<p><strong>步骤2：</strong>WP后台设置调用该模板<br />
登录到你的后台，页面-&gt;添加新页面，在标题栏中输入“留言本”，文本区域置空，选择右下角的属性框的模板下来列表为之前建立的模板guestbook，如图：<br />
<img src="http://www.ihiro.org/blog/wp-content/uploads/2009/07/tpl.jpg" alt="tpl" title="tpl" width="281" height="307" class="aligncenter size-full wp-image-251" /><br />
然后点击发布即可。</p>
<p><strong>步骤3：</strong>确认导航栏块代码是否使用wp_list_pages(”);函数来输出所建立的页面。</p>
<p>根据上面的步骤你就可以完成自定义个性单页模板的制作和配置，大家可以发挥想象，通过修改源代码的方式创建相册单页啊、电影单页啊，等等。</p>
<h2  class="related_post_title">你也许会喜欢阅读这些：</h2><ul class="related_post"><li>2009年11月25日 -- <a href="http://www.ihiro.org/wordpress-the-article-automatically-appear-as-two" title="Wordpress:将文章自动显示为两列">Wordpress:将文章自动显示为两列</a> (13)</li><li>2009年07月30日 -- <a href="http://www.ihiro.org/how-to-remove-the-version-information-in-wordpress" title="Wordpress:如何去除wp中的版本信息">Wordpress:如何去除wp中的版本信息</a> (16)</li><li>2009年07月24日 -- <a href="http://www.ihiro.org/display-tags-in-a-dropdown-list-box" title="Wordpress:显示tags在一个下拉列表中">Wordpress:显示tags在一个下拉列表中</a> (8)</li><li>2009年07月22日 -- <a href="http://www.ihiro.org/2-wp-tips" title="Wordpress:两个wp的小技巧，非常实用哦！">Wordpress:两个wp的小技巧，非常实用哦！</a> (12)</li><li>2009年06月18日 -- <a href="http://www.ihiro.org/wordpress-study-notes-url-settings" title="WordPress学习笔记&#8211;url设置">WordPress学习笔记&#8211;url设置</a> (8)</li><li>2011年04月20日 -- <a href="http://www.ihiro.org/css3-transition" title="CSS3:Transition属性详解">CSS3:Transition属性详解</a> (82)</li><li>2011年04月1日 -- <a href="http://www.ihiro.org/html5-reading-note-chp4-canvas" title="HTML5:《HTML5. Up and Running》读书笔记.Chp4.Canvas">HTML5:《HTML5. Up and Running》读书笔记.Chp4.Canvas</a> (22)</li><li>2011年03月21日 -- <a href="http://www.ihiro.org/html5-reading-note-chp3-elements" title="HTML5:《HTML5. Up and Running》读书笔记.Chp3.Elements">HTML5:《HTML5. Up and Running》读书笔记.Chp3.Elements</a> (24)</li><li>2011年03月15日 -- <a href="http://www.ihiro.org/html5-reading-note-chp2-features" title="HTML5:《HTML5. Up and Running》读书笔记.Chp2.Features">HTML5:《HTML5. Up and Running》读书笔记.Chp2.Features</a> (23)</li><li>2010年11月22日 -- <a href="http://www.ihiro.org/text-range" title="Range:文本框选区学习笔记">Range:文本框选区学习笔记</a> (16)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ihiro.org/custom-and-configure-a-single-page-template/feed</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>WordPress学习笔记&#8211;url设置</title>
		<link>http://www.ihiro.org/wordpress-study-notes-url-settings</link>
		<comments>http://www.ihiro.org/wordpress-study-notes-url-settings#comments</comments>
		<pubDate>Thu, 18 Jun 2009 09:12:11 +0000</pubDate>
		<dc:creator>Hiro</dc:creator>
				<category><![CDATA[Hack技巧]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[学习笔记]]></category>

		<guid isPermaLink="false">http://www.ihiro.org/?p=19</guid>
		<description><![CDATA[设置方法：

1. 登录Wordperss后台, 点击导航菜单右侧的Setting（设置）选项；
2. 进入, WordPress address (URL)保持不变. Blog address (URL)由原来的http://www.ihiro.org/blog更改为 http://www.ihiro.org/；]]></description>
			<content:encoded><![CDATA[<p>说明：我的wp安装在子目录blog下，希望用域名http://www.ihiro.org/替换http://www.ihiro.org/blog/直接访问我的博客。设置方法：</p>
<p>1. 登录Wordperss后台, 点击导航菜单右侧的Setting（设置）选项；<br />
2. 进入, WordPress address (URL)保持不变. Blog address (URL)由原来的http://www.ihiro.org/blog更改为 http://www.ihiro.org/；<br />
3. 复制一份blog子目录文件夹里面的index.php文件, 打开, 把</p>

<div class="wp_codebox"><table><tr id="p1941"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p19code41"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php
    <span style="color: #666666; font-style: italic;">/* Short and sweet */</span>
    <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span>’WP_USE_THEMES’<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span>’<span style="color: #339933;">./</span>wp<span style="color: #339933;">-</span>blog<span style="color: #339933;">-</span><span style="color: #990000;">header</span><span style="color: #339933;">.</span>php‘<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>修改为</p>

<div class="wp_codebox"><table><tr id="p1942"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p19code42"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php
    <span style="color: #666666; font-style: italic;">/* Short and sweet */</span>
    <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span>’WP_USE_THEMES’<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span>’<span style="color: #339933;">./</span>blog<span style="color: #339933;">/</span>wp<span style="color: #339933;">-</span>blog<span style="color: #339933;">-</span><span style="color: #990000;">header</span><span style="color: #339933;">.</span>php‘<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>4. 把修改后的这份index.php上传到根目录；<br />
5. 至此，便可以使用www.ihiro.org直接访问我的Blog。</p>
<h2  class="related_post_title">你也许会喜欢阅读这些：</h2><ul class="related_post"><li>2009年11月25日 -- <a href="http://www.ihiro.org/wordpress-the-article-automatically-appear-as-two" title="Wordpress:将文章自动显示为两列">Wordpress:将文章自动显示为两列</a> (13)</li><li>2009年07月30日 -- <a href="http://www.ihiro.org/how-to-remove-the-version-information-in-wordpress" title="Wordpress:如何去除wp中的版本信息">Wordpress:如何去除wp中的版本信息</a> (16)</li><li>2009年07月24日 -- <a href="http://www.ihiro.org/display-tags-in-a-dropdown-list-box" title="Wordpress:显示tags在一个下拉列表中">Wordpress:显示tags在一个下拉列表中</a> (8)</li><li>2009年07月22日 -- <a href="http://www.ihiro.org/2-wp-tips" title="Wordpress:两个wp的小技巧，非常实用哦！">Wordpress:两个wp的小技巧，非常实用哦！</a> (12)</li><li>2009年07月20日 -- <a href="http://www.ihiro.org/custom-and-configure-a-single-page-template" title="Wordpress:自定义单页模板的制作和配置">Wordpress:自定义单页模板的制作和配置</a> (20)</li><li>2011年04月20日 -- <a href="http://www.ihiro.org/css3-transition" title="CSS3:Transition属性详解">CSS3:Transition属性详解</a> (82)</li><li>2011年04月1日 -- <a href="http://www.ihiro.org/html5-reading-note-chp4-canvas" title="HTML5:《HTML5. Up and Running》读书笔记.Chp4.Canvas">HTML5:《HTML5. Up and Running》读书笔记.Chp4.Canvas</a> (22)</li><li>2011年03月21日 -- <a href="http://www.ihiro.org/html5-reading-note-chp3-elements" title="HTML5:《HTML5. Up and Running》读书笔记.Chp3.Elements">HTML5:《HTML5. Up and Running》读书笔记.Chp3.Elements</a> (24)</li><li>2011年03月15日 -- <a href="http://www.ihiro.org/html5-reading-note-chp2-features" title="HTML5:《HTML5. Up and Running》读书笔记.Chp2.Features">HTML5:《HTML5. Up and Running》读书笔记.Chp2.Features</a> (23)</li><li>2010年11月22日 -- <a href="http://www.ihiro.org/text-range" title="Range:文本框选区学习笔记">Range:文本框选区学习笔记</a> (16)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ihiro.org/wordpress-study-notes-url-settings/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Hello world！</title>
		<link>http://www.ihiro.org/hello-world</link>
		<comments>http://www.ihiro.org/hello-world#comments</comments>
		<pubDate>Thu, 18 Jun 2009 08:27:10 +0000</pubDate>
		<dc:creator>Hiro</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.ihiro.org/blog/?p=1</guid>
		<description><![CDATA[欢迎使用 WordPress 。这是系统自动生成的演示文章。编辑或者删除它，开始您的博客！]]></description>
			<content:encoded><![CDATA[<p>欢迎使用 WordPress 。这是系统自动生成的演示文章。编辑或者删除它，开始您的博客！</p>
<h2  class="related_post_title">你也许会喜欢阅读这些：</h2><ul class="related_post"><li>2010年06月3日 -- <a href="http://www.ihiro.org/wordpress-3-new-features" title="Wordpress:3.0版本特性，将改变你的内容管理方式">Wordpress:3.0版本特性，将改变你的内容管理方式</a> (12)</li><li>2010年03月25日 -- <a href="http://www.ihiro.org/the-enhanced-ajax-effect-instructions" title="Ajax:近期博客改版的增强Ajax加载说明">Ajax:近期博客改版的增强Ajax加载说明</a> (43)</li><li>2010年02月20日 -- <a href="http://www.ihiro.org/how-to-insert-googlebuzz-data-into-blog" title="Wordpress:如何将GoogleBuzz数据插入到博客中">Wordpress:如何将GoogleBuzz数据插入到博客中</a> (11)</li><li>2009年11月25日 -- <a href="http://www.ihiro.org/wordpress-the-article-automatically-appear-as-two" title="Wordpress:将文章自动显示为两列">Wordpress:将文章自动显示为两列</a> (13)</li><li>2009年11月8日 -- <a href="http://www.ihiro.org/my-third-theme-innernews" title="主题:我的第三个主题innerNews提供下载">主题:我的第三个主题innerNews提供下载</a> (24)</li><li>2009年09月16日 -- <a href="http://www.ihiro.org/including-wordpress-comment-reply-js" title="Wordpress:正确地引入comment-reply.js文件">Wordpress:正确地引入comment-reply.js文件</a> (23)</li><li>2009年09月13日 -- <a href="http://www.ihiro.org/wordpress-2-9-version-new-features" title="Wordpress:2.9版本&#8211;新的特性">Wordpress:2.9版本&#8211;新的特性</a> (13)</li><li>2009年09月6日 -- <a href="http://www.ihiro.org/highlight-the-administrators-reply-message" title="Wordpress:高亮管理员的留言信息">Wordpress:高亮管理员的留言信息</a> (37)</li><li>2009年08月31日 -- <a href="http://www.ihiro.org/4-ways-to-display-the-copyrights-of-blog" title="Wordpress:4个常见的显示博客版权的方法">Wordpress:4个常见的显示博客版权的方法</a> (10)</li><li>2009年08月13日 -- <a href="http://www.ihiro.org/the-reason-of-update-password-reset-loophole" title="Wordpress:最新2.84更新的原因：密码重置漏洞（图文教程解决）">Wordpress:最新2.84更新的原因：密码重置漏洞（图文教程解决）</a> (15)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ihiro.org/hello-world/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
