<?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; Hack</title>
	<atom:link href="http://www.ihiro.org/tag/hack/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:将文章自动显示为两列</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="p8231"><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="p823code1"><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="p8232"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code" id="p823code2"><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>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="p5903"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p590code3"><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="p5904"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p590code4"><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="p5905"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code" id="p590code5"><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: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="p5196"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p519code6"><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="p5197"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p519code7"><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="p5198"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p519code8"><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="p5199"><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="p519code9"><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="p41510"><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="p415code10"><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="p41511"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code" id="p415code11"><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="p41512"><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="p415code12"><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="p41513"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p415code13"><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="p41514"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p415code14"><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>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="p27115"><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="p271code15"><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="p27116"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p271code16"><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>
	</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! -->
