<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>活着 &#187; wordpress</title>
	<atom:link href="http://www.yetlive.com/tags/wordpress/feed" rel="self" type="application/rss+xml" />
	<link>http://www.yetlive.com</link>
	<description>认真对待生活每一天。一个非IT人士的网络之旅</description>
	<lastBuildDate>Mon, 12 Jul 2010 01:44:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		
<!-- Start Of Script Generated By WP-PostViews Plus -->
<script type='text/javascript' src='http://www.yetlive.com/wp-includes/js/jquery/jquery.js?ver=1.3.2'></script>
<script type="text/javascript">
/* <![CDATA[ */
jQuery.ajax({type:'GET',url:'http://www.yetlive.com/wp-content/plugins/wp-postviews-plus/postviews_plus.php',data:'todowppvp=add&type=tag&id=50_1',cache:false,dataType:'script'});
/* ]]> */
</script>
<!-- End Of Script Generated By WP-PostViews Plus -->
	<item>
		<title>用Wordpress短代码在博客任意部分添加广告</title>
		<link>http://www.yetlive.com/post/wordpress-shortcode-to-add-adsense.html</link>
		<comments>http://www.yetlive.com/post/wordpress-shortcode-to-add-adsense.html#comments</comments>
		<pubDate>Mon, 03 May 2010 01:26:41 +0000</pubDate>
		<dc:creator>zp1214</dc:creator>
				<category><![CDATA[技术笔记]]></category>
		<category><![CDATA[adsense]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[广告]]></category>

		<guid isPermaLink="false">http://www.yetlive.com/?p=970</guid>
		<description><![CDATA[其实不怎么满意现在文内广告的位置，本来是想通过判断WP中的more标签位置插入广告的，奈何自己总是很懒，加上毕业设计的任务压在头上，也就作罢了，忽然想起WP的短代码功能似乎可以实现此功能，于是翻了翻Wordpress Popular Posts的代码，找出了此段代码，这样就可以轻松在博客文章或者Wordpress侧栏中任意位置添加Adsense广告了。
代码很简单，把以下的代码加入到主题的functions.php中：
function showad() {
 return &#8217;&#60;div class=&#8221;advertise&#8221;&#62;
 //这里放你的Adsense广告代码
 &#60;/div&#62;&#8217;;
 }
 add_shortcode(&#8216;advertise&#8217;, &#8217;showad&#8217;);

然后在你想要植入Adsense广告的地方添加[advertise]即可。
通过以上简短的代码可以看出，add_shortcode();中第二个参数为需要添加的函数，第一个参数为使用短代码功能是方括号中应当包含的部分，而return &#8221;语句的两个单引号之间可以放任何你想要放的代码，也就是说短代码不光能够控制广告的位置，也可以实现很多其他的功能，比如我现在用到的Wordpress Popular Posts插件和Clean Archives Reloaded插件中都应用到了这个功能。
]]></description>
			<content:encoded><![CDATA[<p>其实不怎么满意现在文内广告的位置，本来是想通过判断WP中的more标签位置插入广告的，奈何自己总是很懒，加上毕业设计的任务压在头上，也就作罢了，忽然想起WP的短代码功能似乎可以实现此功能，于是翻了翻<a href="http://wordpress.org/extend/plugins/wordpress-popular-posts/" target="_blank">Wordpress Popular Posts</a>的代码，找出了此段代码，这样就可以轻松在博客文章或者<a href="http://www.yetlive.com/">Wordpress</a>侧栏中任意位置添加Adsense广告了。<span id="more-970"></span></p>
<p>代码很简单，把以下的代码加入到主题的functions.php中：</p>
<blockquote><p>function showad() {<br />
 return &#8217;&lt;div class=&#8221;advertise&#8221;&gt;<br />
<span style="color: #ff0000;"> //这里放你的Adsense广告代码</span><br />
 &lt;/div&gt;&#8217;;<br />
 }<br />
 add_shortcode(&#8216;advertise&#8217;, &#8217;showad&#8217;);</p>
</blockquote>
<p>然后在你想要植入<a href="http://www.yetlive.com/tags/adsense">Adsense</a>广告的地方添加[advertise]即可。</p>
<p>通过以上简短的代码可以看出，add_shortcode();中第二个参数为需要添加的函数，第一个参数为使用短代码功能是方括号中应当包含的部分，而return &#8221;语句的两个单引号之间可以放任何你想要放的代码，也就是说短代码不光能够控制<a href="http://www.yetlive.com/post/hide-your-adsense.html">广告的位置</a>，也可以实现很多其他的功能，比如我现在用到的<a href="http://wordpress.org/extend/plugins/wordpress-popular-posts/" target="_blank">Wordpress Popular Posts</a>插件和<a href="http://wordpress.org/extend/plugins/clean-archives-reloaded/" target="_blank">Clean Archives Reloaded</a>插件中都应用到了这个功能。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yetlive.com/post/wordpress-shortcode-to-add-adsense.html/feed</wfw:commentRss>
		<slash:comments>36</slash:comments>
		</item>
		<item>
		<title>.htaccess中开启Gzip加速网页展示</title>
		<link>http://www.yetlive.com/post/htaccess-gzip.html</link>
		<comments>http://www.yetlive.com/post/htaccess-gzip.html#comments</comments>
		<pubDate>Wed, 28 Apr 2010 06:33:24 +0000</pubDate>
		<dc:creator>zp1214</dc:creator>
				<category><![CDATA[技术笔记]]></category>
		<category><![CDATA[seo]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.yetlive.com/?p=968</guid>
		<description><![CDATA[Gzip的作用简单点说起来就相当于将服务器上的文件压缩为一个.gz后缀的文件，类似将文件压缩成.zip格式，然后将.gz格式的文件再发送给浏览器，由于压缩后文件大小减少了很多，因而能起到提速的功能，也能减少服务器流量，对于页面文件比较大或者类似活着这种服务器在国外的时候，开启Gzip功能是很有效的加快网站打开速度的解决方法。本文会介绍的是在.htaccess中启用Gzip的方法。
Wordpress2.5版本以前自带了Gzip功能，也就无需理会以下的操作，另外wordpress中还有些其他的插件能够实现此功能，如wp super cache就能设置开启Gzip提速。本站其实使用了wp super cache插件，然而为了能够保证首页能够在更新文章或评论后第一时间显示出来，也就并未缓存首页，于是首页速度就会下降。为了能够把所有的页面都通过Gzip提速，折腾了很久总算是找到了一个最简单的方法，在.htaccess中启用Gzip，比起php启用Gzip的方法绝对省事很多。
只要在.htaccess文件中加入如下片段即可，当然一下代码需要主机有mod_deflate模块：
&#60;ifmodule mod_deflate.c&#62;
 AddOutputFilter DEFLATE html xml php js css
 &#60;/ifmodule&#62;

添加好以上的代码片段之后需要在WP Super Cache插件的后台设置中禁用压缩功能，因为.htaccess中的代码保证所有的文件都经过压缩了，这里不要重复做此步骤了。
目前本站所有页面都通过上述方法进行Gzip压缩了，各位有没有感觉到首页速度加快了呢？
]]></description>
			<content:encoded><![CDATA[<p>Gzip的作用简单点说起来就相当于将服务器上的文件压缩为一个.gz后缀的文件，类似将文件压缩成.zip格式，然后将.gz格式的文件再发送给浏览器，由于压缩后文件大小减少了很多，因而能起到提速的功能，也能减少服务器流量，对于页面文件比较大或者类似<a href="http://www.yetlive.com">活着</a>这种服务器在国外的时候，开启Gzip功能是很有效的<a href="http://www.yetlive.com/post/speed-up.html">加快网站打开速度</a>的解决方法。本文会介绍的是在.htaccess中启用Gzip的方法。<span id="more-968"></span></p>
<p>Wordpress2.5版本以前自带了Gzip功能，也就无需理会以下的操作，另外<a href="http://www.yetlive.com/">wordpress</a>中还有些其他的插件能够实现此功能，如wp super cache就能设置开启Gzip提速。本站其实使用了<a href="http://wordpress.org/extend/plugins/wp-super-cache/" target="_blank">wp super cache</a>插件，然而为了能够保证首页能够在更新文章或评论后第一时间显示出来，也就并未缓存首页，于是首页速度就会下降。为了能够把所有的页面都通过Gzip提速，折腾了很久总算是找到了一个最简单的方法，在.htaccess中启用Gzip，比起<a href="http://www.yetlive.com/tags/php">php</a>启用Gzip的方法绝对省事很多。</p>
<p>只要在.htaccess文件中加入如下片段即可，当然一下代码需要主机有mod_deflate模块：</p>
<blockquote><p>&lt;ifmodule mod_deflate.c&gt;<br />
 AddOutputFilter DEFLATE html xml php js css<br />
 &lt;/ifmodule&gt;</p>
</blockquote>
<p>添加好以上的代码片段之后需要在<a href="http://wordpress.org/extend/plugins/wp-super-cache/" target="_blank">WP Super Cache</a>插件的后台设置中<span style="color: #ff0000;">禁用压缩功能</span>，因为.htaccess中的代码保证所有的文件都经过压缩了，这里不要重复做此步骤了。</p>
<p>目前本站所有页面都通过上述方法进行Gzip压缩了，各位有没有感觉到<a href="http://www.yetlive.com/post/speed-up.html" target="_blank">首页速度加快</a>了呢？</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yetlive.com/post/htaccess-gzip.html/feed</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>如何让WP主题同时支持嵌套评论与邮件回复</title>
		<link>http://www.yetlive.com/post/support-thread-comment-and-mail-to-commenter.html</link>
		<comments>http://www.yetlive.com/post/support-thread-comment-and-mail-to-commenter.html#comments</comments>
		<pubDate>Fri, 09 Apr 2010 07:35:13 +0000</pubDate>
		<dc:creator>zp1214</dc:creator>
				<category><![CDATA[技术笔记]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.yetlive.com/?p=926</guid>
		<description><![CDATA[本着折腾到底不罢休的精神，又给博客做了个手术，这手术做的可不轻松，啃下了WP最艰难的部分。本次修改主要是为了支持嵌套回复，也是为了提高用户体验的一个重大举措吧，其实要纯粹的支持嵌套回复功能倒是简单，然而同时要正常使用ThinkAgain的Mail to Commenter插件来邮件回复的时候，问题就会随之而来了。昨晚折腾到半夜三点，终究是把问题给解决了。关键点在于如何让主题支持嵌套以及如何支持邮件回复。文章末尾有全套代码！
让WP主题支持嵌套回复
首先要解决的是让主题嵌套回复，WP2.7版本后就支持此功能，这里可以参考mg12的WordPress 嵌套回复一文。最简单的方法是使用Wordpress自带的wp_list_comments()来自动解决，然而由于wp自带的wp_list_comments()代码稍嫌臃肿且无法自定义，这时候就需要在模板的function.php文件中来自定义评论显示方法，并在comments.php 中利用wp_list_comments(&#8216;callback=custom_comments&#8217;)来显示自定义评论。
在自定义的评论显示方法中，只需要添加如下代码即可：

View Code PHP &#60; ?php comment_reply_link&#40;array_merge&#40; $args, array&#40;'depth' =&#62; $depth, 'max_depth' =&#62; $args&#91;'max_depth'&#93;&#41;&#41;&#41; ?&#62;

之后在后台设置中允许嵌套回复就可以了。
让回复功能支持Mail to Commenter插件的邮件回复
以上已经介绍了如何让主题支持嵌套回复了，然而以上的方法无法进行自定义，因此也就无法添加邮件回复所需的触发函数，于是我们需要对以上的方法进行适当的修改，通过研究代码，可以看到“回复”的链接实际上有类似这样的代码：

View Code PHPonclick=&#34;addComment.moveForm('comment-&#60; ?php comment_ID() ?&#62;','&#60; ?php comment_ID() ?&#62;', 'respond', '&#60; ?php echo $post-&#62;ID; ?&#62;');&#34;

其中的&#8217;comment-< ?php comment_ID() ?>&#8216;会根据主题而不同例如WP自带的评论回复中该项就是&#8217;div-comment-&#8217;。而另外一个&#8217;respond&#8216;可能会根据不同主题不同，没有过多研究，各位可以自己尝试下。www.yetlive.com
也就是说自定义的时候只要修改下此处就好了，其中还要注意到的一个问题就是判断支持几层嵌套，当嵌套层数超出了WP后台设置的深度时则需要做相应处理，研究了WP的comment-template.php代码后，可以得到如下的方法判断是否已经超出嵌套层数：

View Code PHP if&#40; $depth&#60;get_option&#40;'thread_comments_depth'&#41;&#41;

有了这些基础之后，就需要再为此回复链接带上邮件回复触发机制，大家知道Mail to Commenter插件会识别回复中是否存在@user 或者@user：来自动回复邮件，那么就需要为链接上加上一点Javascript代码让其有此功能，我研究了inove的JS代码后，借用如下：

View Code PHPRE_CON.reply&#40;'commentauthor-&#60; ?php comment_ID() ?&#62;','comment-&#60; ?php comment_ID() ?&#62;','comment'&#41;;

然后需要在主题的头部调用外部JS文件，此JS文件中加入如下代码：

View Code JAVASCRIPT&#40;function&#40;&#41; &#123;
function [...]]]></description>
			<content:encoded><![CDATA[<p>本着折腾到底不罢休的精神，又给博客做了个手术，这手术做的可不轻松，啃下了WP最艰难的部分。本次修改主要是为了支持嵌套回复，也是为了提高用户体验的一个重大举措吧，其实要纯粹的支持嵌套回复功能倒是简单，然而同时要正常使用<a href="http://www.thinkagain.cn/" target="_blank">ThinkAgain</a>的<a href="http://wordpress.org/extend/plugins/mailtocommenter/" target="_blank">Mail to Commenter</a>插件来邮件回复的时候，问题就会随之而来了。昨晚折腾到半夜三点，终究是把问题给解决了。关键点在于如何让主题支持嵌套以及如何支持邮件回复。<span style="color: #ff0000;"><strong>文章末尾有全套代码</strong>！</span><span id="more-926"></span></p>
<h3>让WP主题支持嵌套回复</h3>
<p>首先要解决的是让主题嵌套回复，WP2.7版本后就支持此功能，这里可以参考mg12的<a href="http://www.neoease.com/wordpress-thread-comments/" target="_blank">WordPress 嵌套回复</a>一文。最简单的方法是使用Wordpress自带的wp_list_comments()来自动解决，然而由于wp自带的wp_list_comments()代码稍嫌臃肿且无法自定义，这时候就需要在模板的function.php文件中来自定义评论显示方法，并在comments.php 中利用wp_list_comments(&#8216;callback=custom_comments&#8217;)来显示自定义评论。</p>
<p>在自定义的评论显示方法中，只需要添加如下代码即可：</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p926code7'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p9267"><td class="code" id="p926code7"><pre class="php" style="font-family:monospace;"> <span style="color: #339933;">&lt;</span> ?php comment_reply_link<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;">'depth'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$depth</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'max_depth'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$args</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'max_depth'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>之后在后台设置中允许嵌套回复就可以了。</p>
<h3>让回复功能支持Mail to Commenter插件的邮件回复</h3>
<p>以上已经介绍了如何让主题支持嵌套回复了，然而以上的方法无法进行自定义，因此也就无法添加邮件回复所需的触发函数，于是我们需要对以上的方法进行适当的修改，通过研究代码，<strong>可以看到“回复”的链接实际上有类似这样的代码</strong>：</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p926code8'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p9268"><td class="code" id="p926code8"><pre class="php" style="font-family:monospace;">onclick<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;addComment.moveForm('comment-&lt; ?php comment_ID() ?&gt;','&lt; ?php comment_ID() ?&gt;', 'respond', '&lt; ?php echo <span style="color: #006699; font-weight: bold;">$post-&gt;ID</span>; ?&gt;');&quot;</span></pre></td></tr></table></div>

<p>其中的&#8217;<span style="color: #ff0000;">comment</span>-< ?php comment_ID() ?>&#8216;会根据主题而不同例如WP自带的评论回复中该项就是&#8217;<span style="color: #ff0000;">div-comment</span>-&#8217;。而另外一个&#8217;<span style="color: #ff0000;">respond</span>&#8216;可能会根据不同主题不同，没有过多研究，各位可以自己尝试下。www.yetlive.com</p>
<p>也就是说自定义的时候只要修改下此处就好了，<strong>其中还要注意到的一个问题就是判断支持几层嵌套，当嵌套层数超出了WP后台设置的深度时则需要做相应处理</strong>，研究了WP的comment-template.php代码后，可以得到如下的方法判断是否已经超出嵌套层数：</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p926code9'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p9269"><td class="code" id="p926code9"><pre class="php" style="font-family:monospace;"> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$depth</span><span style="color: #339933;">&lt;</span>get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'thread_comments_depth'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span></pre></td></tr></table></div>

<p>有了这些基础之后，就需要再为此回复链接带上邮件回复触发机制，大家知道Mail to Commenter插件会识别回复中是否存在@user 或者@user：来自动回复邮件，那么就需要为链接上加上一点Javascript代码让其有此功能，我研究了inove的JS代码后，借用如下：</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p926code10'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p92610"><td class="code" id="p926code10"><pre class="php" style="font-family:monospace;">RE_CON<span style="color: #339933;">.</span>reply<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'commentauthor-&lt; ?php comment_ID() ?&gt;'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'comment-&lt; ?php comment_ID() ?&gt;'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'comment'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>然后需要在主题的头部调用外部JS文件，此JS文件中加入如下代码：</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p926code11'); return false;">View Code</a> JAVASCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p92611"><td class="code" id="p926code11"><pre class="javascript" style="font-family:monospace;"><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;">function</span> $<span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">return</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
window<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'RE'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
window<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'RE'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'$'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> $<span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">function</span> reply<span style="color: #009900;">&#40;</span>authorId<span style="color: #339933;">,</span> commentId<span style="color: #339933;">,</span> commentBox<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> author <span style="color: #339933;">=</span> RE.$<span style="color: #009900;">&#40;</span>authorId<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">innerHTML</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> insertStr <span style="color: #339933;">=</span> <span style="color: #3366CC;">'&lt;a href=&quot;#'</span> <span style="color: #339933;">+</span> commentId <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&quot;&gt;@'</span><span style="color: #339933;">+</span> author.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\t|\n|\r\n/g</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">':&lt;/a&gt; <span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: #339933;">;</span>
	insertReply<span style="color: #009900;">&#40;</span>insertStr<span style="color: #339933;">,</span> commentBox<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #003366; font-weight: bold;">function</span> insertReply<span style="color: #009900;">&#40;</span>insertStr<span style="color: #339933;">,</span> commentBox<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>RE.$<span style="color: #009900;">&#40;</span>commentBox<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> RE.$<span style="color: #009900;">&#40;</span>commentBox<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">type</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">'textarea'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		field <span style="color: #339933;">=</span> RE.$<span style="color: #009900;">&#40;</span>commentBox<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;The comment box does not exist!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>field.<span style="color: #660066;">value</span>.<span style="color: #660066;">indexOf</span><span style="color: #009900;">&#40;</span>insertStr<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;You've already appended this reply!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>field.<span style="color: #660066;">value</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\s|\t|\n/g</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		field.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> insertStr<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
		field.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> field.<span style="color: #660066;">value</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/[\n]*$/g</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>'</span> <span style="color: #339933;">+</span> insertStr<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
window<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'RE_CON'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
window<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'RE_CON'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'reply'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> reply<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>之后，我们的嵌套回复于邮件回复功能就可以实现了。<span style="color: #ff0000;">于是我最终的方法就如下了，也是本主题中用到的方法</span>：</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p926code12'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p92612"><td class="code" id="p926code12"><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><span style="color: #339933;">!</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'mailtocommenter_button'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>comment_reply_link<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;">'reply_text'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Reply'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'depth'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$depth</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'max_depth'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$args</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'max_depth'</span><span style="color: #009900;">&#93;</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: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'mailtocommenter_button'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$depth</span><span style="color: #339933;">&lt;</span>get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'thread_comments_depth'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
    <span style="color: #339933;">&lt;</span>a  rel<span style="color: #339933;">=</span><span style="color: #0000ff;">'nofollow'</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'comment-reply-link'</span> href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;javascript:void(0);&quot;</span> onclick<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;addComment.moveForm('comment-&lt;?php comment_ID() ?&gt;','&lt; ?php comment_ID() ?&gt;', 'respond', '&lt;?php echo <span style="color: #006699; font-weight: bold;">$post-&gt;ID</span>; ?&gt;');RE_CON.reply('commentauthor-&lt; ?php comment_ID() ?&gt;','comment-&lt; ?php comment_ID() ?&gt;','comment'); &quot;</span><span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span> ?php _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Reply'</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>
    <span style="color: #339933;">&lt;</span> ?php <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
    <span style="color: #339933;">&lt;</span>a  rel<span style="color: #339933;">=</span><span style="color: #0000ff;">'nofollow'</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'comment-reply-link'</span> href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;javascript:void(0);&quot;</span> onclick<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;RE_CON.reply('commentauthor-&lt; ?php comment_ID() ?&gt;','comment-&lt; ?php comment_ID() ?&gt;','comment'); &quot;</span><span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span> ?php _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Reply'</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>
    <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>其实在本人的修改中添加了对是否存在邮件回复插件的判断，其实如果是自己用的话不判断也可以，为了方便大家的使用才做了这样的处理，<span style="color: #ff0000;">至于说到JS文件，可以自己打开</span><a href="http://www.yetlive.com/wp-content/themes/simpleblue/js/common.js" target="_blank"><span style="color: #ff0000;">http://www.yetlive.com/wp-content/themes/simpleblue/js/common.js</span></a><span style="color: #ff0000;">复制粘贴</span>。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yetlive.com/post/support-thread-comment-and-mail-to-commenter.html/feed</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>如何让wp-recentcomments不显示管理员评论</title>
		<link>http://www.yetlive.com/post/how-to-hide-recentcomments-by-admin.html</link>
		<comments>http://www.yetlive.com/post/how-to-hide-recentcomments-by-admin.html#comments</comments>
		<pubDate>Mon, 29 Mar 2010 02:08:27 +0000</pubDate>
		<dc:creator>zp1214</dc:creator>
				<category><![CDATA[技术笔记]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.yetlive.com/?p=899</guid>
		<description><![CDATA[安装了MG12的wp-recentcomments插件用来增强显示最新的评论，然而用着一直有些问题，就是无法屏蔽掉管理员的回复评论，在其插件的发布页面也见到有人提及此问题，然而却没有给出一个解决的办法，制作者mg12只是说判断评论“不是通过 email 的, 是通过数据库中记录的权限. 如果是 administrator 就认为是管理员.”可惜本人在安装博客之后就把最原始的管理员帐号直接给删除了，换了个管理员用户，然后就无法正常了。
这次更换服务器以及域名，把之前的数据库迁移了过来，于是决定一不做二不休把数据库的东西都修改下，顺便也把此问题也解决掉，经过一番折腾后终于找到了解决方法，而且用至现在还没发现什么问题。
在phpMyAdmin下是使用以下两句SQL语句就能轻松搞定：（切记在操作前备份你的数据库）
UPDATE wp_users SET ID = replace( ID, &#8216;*&#8216;, &#8216;1&#8242; ) ; /*修改用户ID*/  
 UPDATE wp_usermeta SET user_id = replace( user_id, &#8216;*&#8216;, &#8216;1&#8242; ) ; /*修改管理员关联信息*/
 UPDATE wp_posts SET post_author = replace( post_author, &#8216;*&#8216;, &#8216;1&#8242; ) ; /*修正ID更换后后台显示用户文章为0的问题*/

注意：请将以上的“*”号修改为你当前的wp_users当中管理员的ID。以上语句的意思即
UPDATE 表名 SET 字段 = REPLACE(字段, ‘替换内容’ , ‘替换值’);

当然，你也可以直接在phpMyAdmin中编辑。经过以上的修改就可以让你的wp-recentcomments不显示管理员评论了。效果可以见本站的最新评论。
]]></description>
			<content:encoded><![CDATA[<p>安装了MG12的<a rel="nofollow" href="http://www.neoease.com/wp-recentcomments/" target="_blank">wp-recentcomments</a>插件用来增强显示最新的评论，然而用着一直有些问题，就是无法屏蔽掉管理员的回复评论，在其插件的发布页面也见到有人提及此问题，然而却没有给出一个解决的办法，制作者mg12只是说判断评论“不是通过 email 的, 是通过数据库中记录的权限. 如果是 administrator 就认为是管理员.”可惜本人在<a href="http://www.yetlive.com/">安装博客</a>之后就把最原始的管理员帐号直接给删除了，换了个管理员用户，然后就无法正常了。<span id="more-899"></span></p>
<p>这次更换<a href="http://www.yetlive.com">服务器</a>以及域名，把之前的数据库迁移了过来，于是决定一不做二不休把数据库的东西都修改下，顺便也把此问题也解决掉，经过一番折腾后终于找到了解决方法，而且用至现在还没发现什么问题。</p>
<p>在phpMyAdmin下是使用以下两句SQL语句就能轻松搞定：（<span style="color: #ff0000;">切记在操作前备份你的数据库</span>）</p>
<blockquote><p>UPDATE wp_users SET ID = replace( ID, &#8216;<span style="color: #ff0000;">*</span>&#8216;, &#8216;1&#8242; ) ; /*修改用户ID*/  <br />
 UPDATE wp_usermeta SET user_id = replace( user_id, &#8216;<span style="color: #ff0000;">*</span>&#8216;, &#8216;1&#8242; ) ; /*修改管理员关联信息*/<br />
 UPDATE wp_posts SET post_author = replace( post_author, &#8216;<span style="color: #ff0000;">*</span>&#8216;, &#8216;1&#8242; ) ; /*修正ID更换后后台显示用户文章为0的问题*/</p>
</blockquote>
<p><strong><span style="color: #ff0000;">注意</span></strong>：请将以上的“<span style="color: #ff0000;">*</span>”号修改为你当前的wp_users当中管理员的ID。以上语句的意思即</p>
<blockquote><p>UPDATE 表名 SET 字段 = REPLACE(字段, ‘替换内容’ , ‘替换值’);</p>
</blockquote>
<p>当然，你也可以直接在phpMyAdmin中编辑。经过以上的修改就可以让你的wp-recentcomments不显示管理员评论了。效果可以见本站的最新评论。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yetlive.com/post/how-to-hide-recentcomments-by-admin.html/feed</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>新年新面貌新主题</title>
		<link>http://www.yetlive.com/post/new-theme.html</link>
		<comments>http://www.yetlive.com/post/new-theme.html#comments</comments>
		<pubDate>Fri, 01 Jan 2010 13:27:15 +0000</pubDate>
		<dc:creator>zp1214</dc:creator>
				<category><![CDATA[小站动向]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[主题]]></category>

		<guid isPermaLink="false">http://www.tinydiary.cn/?p=803</guid>
		<description><![CDATA[赶在这新年的头一天换上完全自主知识产权的新皮，新的一年，新的开始，不能算是迷信，也是想图个喜庆图个吉利。
新主题参考了很多优秀的主题，充分吸收各家所长，形成了现在中西结合的风格，或者说的比较不好听的就是个“骡子”吧，总之是杂交品种了。这款Wordpress主题在风格上可以归类于杂志主题和两栏主题的一个混合模式吧。

新的主题依然延续了盒子风格，全是一个一个方框组成，看起来有点死板吧，然而自己实在是造不出个好图片，之后纯CSS打造外观界面风格了。新的WP主题暂时不会发不，不想像INOVE一样被太多人复制就没了风格，也算是比较自私的了，不过我会在随后分离出一个功能精简后的wordpress主题出来并与大家分享。
主题截图：




新主题采用了920px的宽度，感觉会比较宽敞一点，信息承载量非常的大，不过缺点就是以后必须要多码点字才能对得起这么个宽度，底部添加了大量的信息空间，而侧栏的设计能够容纳更多信息，也为广告留下了灵活的空间，而我最喜换的是首页的设计，摆脱了博客首页都是文章列表这一通用模式，不得不赞一下WP的强大与灵活。
为了赶着在新年第一天穿上这款新衣，有些东西还不是很完善，比如右侧最新评论会显示管理员的评论，似乎是与插件冲突，因为在本地测试的时候没有出现这个问题，头部右侧留白了，没有Banner可放，首页的右边栏并未规划好，还没添加Feed订阅部分，浏览器兼容也还没测试，电脑系统重装之后一直没装全浏览器，不过IE6没多大问题的话基本就算是成功了吧。
最大的问题在于首页上面文章的统计数字不对，调用的是置顶文章，在IE和Firefox下打开首页点击数字会自动加1，当然是用了Super Cache之后用户可能看不出来。
其他问题还没有发现，希望各位博主帮忙测试。
最后再次祝大家元旦快乐！！
]]></description>
			<content:encoded><![CDATA[<p>赶在这新年的头一天换上完全自主知识产权的新皮，新的一年，新的开始，不能算是迷信，也是想图个喜庆图个吉利。</p>
<p>新主题参考了很多优秀的主题，充分吸收各家所长，形成了现在中西结合的风格，或者说的比较不好听的就是个“骡子”吧，总之是杂交品种了。这款Wordpress主题在风格上可以归类于杂志主题和两栏主题的一个混合模式吧。</p>
<p><span id="more-825"></span></p>
<p>新的主题依然延续了<a href="http://www.yetlive.com/post/z-joy-on-live.html">盒子风格</a>，全是一个一个方框组成，看起来有点死板吧，然而自己实在是造不出个好图片，之后<a href="http://www.yetlive.com/post/css-first-letter.html">纯CSS打造外观界面风格</a>了。新的WP<a href="http://www.yetlive.com/post/theme-advise.html">主题</a>暂时不会发不，不想像INOVE一样被太多人复制就没了风格，也算是比较自私的了，不过我会在随后分离出一个功能精简后的wordpress主题出来并与大家分享。</p>
<p>主题截图：</p>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<div id="attachment_805" class="wp-caption alignnone" style="width: 229px"><a href="http://www.yetlive.com/wp-content/uploads/2010/01/themeimag1.gif"><img class="size-medium wp-image-805 " title="themeimag" src="http://www.yetlive.com/uploads/2010/01/themeimag-219x300.gif" alt="主题预览图片" width="219" height="300" /></a><p class="wp-caption-text">主题截图</p></div>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<p>新<a href="http://www.yetlive.com/post/z-blog-zhutidabao.html">主题</a>采用了920px的宽度，感觉会比较宽敞一点，信息承载量非常的大，不过缺点就是以后必须要多码点字才能对得起这么个宽度，底部添加了大量的信息空间，而侧栏的设计能够容纳更多信息，也为广告留下了灵活的空间，而我最喜换的是首页的设计，摆脱了博客首页都是文章列表这一通用模式，不得不赞一下<a href="http://www.yetlive.com">WP</a>的强大与灵活。</p>
<p>为了赶着在新年第一天穿上这款新衣，有些东西还不是很完善，比如右侧最新评论会显示管理员的评论，似乎是与插件冲突，因为在本地测试的时候没有出现这个问题，头部右侧留白了，没有Banner可放，首页的右边栏并未规划好，还没添加<a href="http://www.yetlive.com/feed">Feed订阅</a>部分，浏览器兼容也还没测试，电脑系统重装之后一直没装全浏览器，不过IE6没多大问题的话基本就算是成功了吧。</p>
<p><strong>最大的问题</strong>在于首页上面文章的统计数字不对，<a href="http://www.yetlive.com/post/wp-sticky-post.html">调用的是置顶文章</a>，在IE和Firefox下打开首页点击数字会自动加1，当然是用了Super Cache之后用户可能看不出来。</p>
<p>其他问题还没有发现，希望各位博主帮忙测试。</p>
<p>最后再次祝大家<a href="http://www.yetlive.com/post/zhufuduanxin.html">元旦</a>快乐！！</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yetlive.com/post/new-theme.html/feed</wfw:commentRss>
		<slash:comments>30</slash:comments>
		</item>
		<item>
		<title>WP获取置顶文章</title>
		<link>http://www.yetlive.com/post/wp-sticky-post.html</link>
		<comments>http://www.yetlive.com/post/wp-sticky-post.html#comments</comments>
		<pubDate>Wed, 23 Dec 2009 13:50:23 +0000</pubDate>
		<dc:creator>zp1214</dc:creator>
				<category><![CDATA[技术笔记]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[主题]]></category>

		<guid isPermaLink="false">http://www.tinydiary.cn/?p=786</guid>
		<description><![CDATA[这几天折腾着给活着换一个新Wordpress主题，自己一直有个癖好用自己制作的主题，比起zblog来说对wordpress还不是很熟悉，制作主题也是劳神劳力，在制作一款类杂志风格主题获取置顶文章的时候就出现了问题，研究了许久才解决了获得置顶文章并使the_content()函数正常显示标签之前的文字。

1. 如何获取WP最新置顶文章
其实在Wordpress官方网站中已经有一个很详细的解释了，你可以在这看到：http://codex.wordpress.org/Template_Tags/query_posts，当然都是洋文的。如果不懂的话我也愿意在这翻译一个。
其实只需要一个比较简单的代码，以下的代码是获取第一篇置顶文章：
$sticky=get_option(&#8217;sticky_posts&#8217;) ; query_posts(&#8216;p=&#8217; . $sticky[0]);

具体的使用方法如下：
$sticky=get_option(&#8217;sticky_posts&#8217;) ;
query_posts(&#8216;p=&#8217; . $sticky[0]);
while (have_posts()) : the_post();
这里写下你需要的东西，如文章标题、内容、分类等等

把以上代码添加到WP主题中，便能够显示出所需要的置顶文章。当然如果你的主题中肯定会需要展示博客的其他文章列表，这时候你可能就不要再次展示置顶文章了，这时候，你需要对以上的代码进行如下的修改：
$sticky=get_option(&#8217;sticky_posts&#8217;) ;
query_posts(&#8216;p=&#8217; . $sticky[0]);
while (have_posts()) : the_post();
$do_not_duplicate = $post-&#62;ID;
这里写下你需要的东西，如文章标题、内容、分类等等

接下来在需要显示博客其他文章的循环中使用如下的外加条件以滤除已经显示的置顶文章：
$args=array(
&#8216;caller_get_posts&#8217;=&#62;1,
&#8216;paged&#8217;=&#62;$paged
);
query_posts($args);
while (have_posts()) : the_post();
if( $post-&#62;ID == $do_not_duplicate ) continue; update_post_caches($posts);
这里写你需要的东西

2.如何解决提取置顶文章后the_content()函数显示全文的问题
在以上的方法中存在另外一个问题，至少我使用EasyPHP进行本地测试的时候出现了这个问题，那就是the_content(&#8216;read more…&#8217;)这个函数不太正常，本应该只显示标签之前的文字，然而提取了置顶文章之后的第二个文章列表循环中会出现显示整个文章内容的问题，具体的原因不是很了解，也没有深入研究，不过这里提供一个简单的方法来解决获取置顶文章与the_content()函数冲突的问题。
需要做的就是在while (have_posts()) : the_post();之前添加一个参数定义，具体的例子如下：
$more = 0;
while (have_posts()) : the_post();
if( $post-&#62;ID == $do_not_duplicate ) continue; update_post_caches($posts);
这里写你需要的东西

以上的一番折腾之后，总算是能够正常显示了，不过本人对于以上的解决方法不是很满意，希望高手也来指导指导。
]]></description>
			<content:encoded><![CDATA[<p>这几天折腾着给活着换一个新Wordpress主题，自己一直有个癖好用自己制作的主题，比起zblog来说对wordpress还不是很熟悉，制作主题也是劳神劳力，在制作一款类杂志风格主题获取置顶文章的时候就出现了问题，研究了许久才解决了获得置顶文章并使the_content()函数正常显示标签之前的文字。</p>
<p><span id="more-786"></span></p>
<h3>1. 如何获取WP最新置顶文章</h3>
<p>其实在Wordpress官方网站中已经有一个很详细的解释了，你可以在这看到：<a href="http://codex.wordpress.org/Template_Tags/query_posts" target="_blank">http://codex.wordpress.org/Template_Tags/query_posts</a>，当然都是洋文的。如果不懂的话我也愿意在这翻译一个。</p>
<p>其实只需要一个比较简单的代码，以下的代码是获取第一篇置顶文章：</p>
<blockquote><p>$sticky=get_option(&#8217;sticky_posts&#8217;) ; query_posts(&#8216;p=&#8217; . $sticky[0]);</p>
</blockquote>
<p>具体的使用方法如下：</p>
<blockquote><p>$sticky=get_option(&#8217;sticky_posts&#8217;) ;</p>
<p>query_posts(&#8216;p=&#8217; . $sticky[0]);</p>
<p>while (have_posts()) : the_post();</p>
<p>这里写下你需要的东西，如文章标题、内容、分类等等</p>
</blockquote>
<p>把以上代码添加到<a href="http://www.yetlive.com">WP主题</a>中，便能够显示出所需要的置顶文章。当然如果你的主题中肯定会需要展示博客的其他文章列表，这时候你可能就不要再次展示置顶文章了，这时候，你需要对以上的代码进行如下的修改：</p>
<blockquote><p>$sticky=get_option(&#8217;sticky_posts&#8217;) ;</p>
<p>query_posts(&#8216;p=&#8217; . $sticky[0]);</p>
<p>while (have_posts()) : the_post();</p>
<p>$do_not_duplicate = $post-&gt;ID;</p>
<p>这里写下你需要的东西，如文章标题、内容、分类等等</p>
</blockquote>
<p>接下来在需要显示博客其他文章的循环中使用如下的外加条件以滤除已经显示的置顶文章：</p>
<blockquote><p>$args=array(</p>
<p>&#8216;caller_get_posts&#8217;=&gt;1,</p>
<p>&#8216;paged&#8217;=&gt;$paged</p>
<p>);</p>
<p>query_posts($args);</p>
<p>while (have_posts()) : the_post();</p>
<p>if( $post-&gt;ID == $do_not_duplicate ) continue; update_post_caches($posts);</p>
<p>这里写你需要的东西</p>
</blockquote>
<h3>2.如何解决提取置顶文章后the_content()函数显示全文的问题</h3>
<p>在以上的方法中存在另外一个问题，至少我使用<a href="http://www.yetlive.com/post/easyphp-unexpected-end-of-apache.html">EasyPHP</a>进行本地测试的时候出现了这个问题，那就是the_content(&#8216;read more…&#8217;)这个函数不太正常，本应该只显示标签之前的文字，然而提取了置顶文章之后的第二个文章列表循环中会出现显示整个文章内容的问题，具体的原因不是很了解，也没有深入研究，不过这里提供一个简单的方法来解决获取置顶文章与the_content()函数冲突的问题。</p>
<p>需要做的就是在while (have_posts()) : the_post();之前添加一个参数定义，具体的例子如下：</p>
<blockquote><p>$more = 0;</p>
<p>while (have_posts()) : the_post();</p>
<p>if( $post-&gt;ID == $do_not_duplicate ) continue; update_post_caches($posts);</p>
<p>这里写你需要的东西</p>
</blockquote>
<p>以上的一番折腾之后，总算是能够正常显示了，不过本人对于以上的解决方法不是很满意，希望高手也来指导指导。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yetlive.com/post/wp-sticky-post.html/feed</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>z-blog转移到wordpress的两个小问题</title>
		<link>http://www.yetlive.com/post/zblog-to-wordpress-questions.html</link>
		<comments>http://www.yetlive.com/post/zblog-to-wordpress-questions.html#comments</comments>
		<pubDate>Tue, 01 Dec 2009 04:02:15 +0000</pubDate>
		<dc:creator>zp1214</dc:creator>
				<category><![CDATA[技术笔记]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[z-blog]]></category>

		<guid isPermaLink="false">http://www.tinydiary.cn/?p=759</guid>
		<description><![CDATA[活着利用neeke所说的方法再加上自己的一点改动，算是基本解决了z-blog转移到Wordpress的问题，也算把URL和tag等都无缝转移了过来，多个tag也能正常，不过在使用过程中还是发现了不太对劲的两个地方。一是文章浏览数，二是simple tags插件的Autolink功能不太正常。

第一个问题关于文章浏览数导入到WP-PostViews插件
月光的通过SQL语句转换WordPress数据中有过描述，文中提到了如果安装了WP-PostViews插件，还可以执行下面的SQL语句将文章点击数导入到WordPress中：
INSERT INTO `wp_postmeta` select  log_ID , log_ID ,&#8217;view&#8217;,log_ViewNums FROM blog_Article ;
然而或许是由于版本不同的关系，WP 2.86数据库的结构有所改动，wp_postmeta 表中已经删除了log_ID这一项，而只有meta_id和post_id这两项，而wp_posts数据表中的ID实际上并非zblog导出的文章ID而是一组自动排序的数字。另外，view项现在已经改成了&#8217;views&#8217;。如果想要导入文章浏览次数，还需要对数据查询方法进一步的修改。wp_postmeta数据表格的结构如下：


该数据表格格式中，meta_id是一个自动编号的数据，所以不用理睬。
本人查询了一下 PostViews 插件的函数，发现其中存在这样的几行：

View Code PHPget_results&#40;&#34;SELECT DISTINCT $wpdb-&#38;gt;posts.*, (meta_value+0) AS views FROM $wpdb-&#38;gt;posts LEFT JOIN $wpdb-&#38;gt;postmeta ON $wpdb-&#38;gt;postmeta.post_id = $wpdb-&#38;gt;posts.ID WHERE post_date &#38;lt; '&#34;.current_time&#40;'mysql'&#41;.&#34;' AND $where AND post_status = 'publish' AND meta_key = 'views' AND post_password = '' ORDER  BY views [...]]]></description>
			<content:encoded><![CDATA[<p>活着利用neeke所说的方法再加上自己的一点改动，算是<a href="http://www.yetlive.com/post/zblog-to-wordpress.html">基本解决了z-blog转移到Wordpress的问题</a>，也算把URL和tag等都无缝转移了过来，多个tag也能正常，不过在使用过程中还是发现了不太对劲的两个地方。一是文章浏览数，二是simple tags插件的Autolink功能不太正常。</p>
<p><span id="more-759"></span></p>
<h3>第一个问题关于文章浏览数导入到WP-PostViews插件</h3>
<p>月光的<a href="http://www.williamlong.info/archives/1148.html" target="_blank">通过SQL语句转换WordPress数据</a>中有过描述，文中提到了如果安装了WP-PostViews插件，还可以执行下面的SQL语句将文章点击数导入到WordPress中：</p>
<p>INSERT INTO `wp_postmeta` select  log_ID , log_ID ,&#8217;view&#8217;,log_ViewNums FROM blog_Article ;</p>
<p>然而或许是由于版本不同的关系，WP 2.86数据库的结构有所改动，wp_postmeta 表中已经删除了log_ID这一项，而只有meta_id和post_id这两项，而wp_posts数据表中的ID实际上并非zblog导出的文章ID而是一组自动排序的数字。另外，view项现在已经改成了&#8217;views&#8217;。如果想要导入文章浏览次数，还需要对数据查询方法进一步的修改。wp_postmeta数据表格的结构如下：</p>
<p><br class="spacer_" /></p>
<div id="attachment_922" class="wp-caption alignnone" style="width: 310px"><img class="size-medium wp-image-922" title="wp postmeta" src="http://www.yetlive.com/wp-content/uploads/2009/12/wp-postmeta-300x128.gif" alt="wp postmeta 表格" width="300" height="128" /><p class="wp-caption-text">wp postmeta 表格</p></div>
<p><br class="spacer_" /></p>
<p>该数据表格格式中，meta_id是一个自动编号的数据，所以不用理睬。</p>
<p>本人查询了一下 PostViews 插件的函数，发现其中存在这样的几行：</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p759code14'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p75914"><td class="code" id="p759code14"><pre class="php" style="font-family:monospace;">get_results<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT DISTINCT <span style="color: #006699; font-weight: bold;">$wpdb</span>-&amp;gt;posts.*, (meta_value+0) AS views FROM <span style="color: #006699; font-weight: bold;">$wpdb</span>-&amp;gt;posts LEFT JOIN <span style="color: #006699; font-weight: bold;">$wpdb</span>-&amp;gt;postmeta ON <span style="color: #006699; font-weight: bold;">$wpdb</span>-&amp;gt;postmeta.post_id = <span style="color: #006699; font-weight: bold;">$wpdb</span>-&amp;gt;posts.ID WHERE post_date &amp;lt; '&quot;</span><span style="color: #339933;">.</span>current_time<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'mysql'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;' AND <span style="color: #006699; font-weight: bold;">$where</span> AND post_status = 'publish' AND meta_key = 'views' AND post_password = '' ORDER  BY views DESC LIMIT <span style="color: #006699; font-weight: bold;">$limit</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>从中看得出来，现在版本的wp PostViews 插件使用了关联数据查询的方法，而我们要想导入文章浏览数还远不止如此简单。</p>
<p><strong>我的思路</strong>是首先利用文章标题相同这一条件找出该文章的posts.ID与blog_Article中的log_ID，然后将数据插入到wp_postmeta表中，post_id的值等于posts.ID，meta_key的值等于views，而meta_value则使用找到的log_ID对应的log_ViewNums值这样就能够解决文章浏览量的问题。</p>
<p>可惜本人SQL不慎了解，还请大牛指点了。</p>
<h3>第二个问题是 Simple Tags 自动链接不太正常</h3>
<p>这个问题不知道是由于该功能对中文支持不好或者是我在导入的时候没有注意好编码，因为我目前在数据库中去查看任何中文的部分，保存的都是一些看起来像乱码的结构。</p>
<p>希望哪位能够好好的研究一下以上两个问题，这样才算真正做到了z-blog和wordpress之间的无缝转移。找到解决的办法还请麻烦通知<a href="http://www.yetlive.com/">活着</a>哦</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yetlive.com/post/zblog-to-wordpress-questions.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Wordpress 一些函数列表</title>
		<link>http://www.yetlive.com/post/wordpress-function-list.html</link>
		<comments>http://www.yetlive.com/post/wordpress-function-list.html#comments</comments>
		<pubDate>Sun, 29 Nov 2009 02:22:44 +0000</pubDate>
		<dc:creator>zp1214</dc:creator>
				<category><![CDATA[技术笔记]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.tinydiary.cn/?p=757</guid>
		<description><![CDATA[收集下WP的一些函数列表方便活着在制作主题的时候使用。另外，Inove主题是一个可以参考的主题，能够找到许多的有用函数，功能强大能够帮助自己制作一款同样强大的主题。

bloginfo(),调用博客信息,函数参数有&#8217;name&#8217;(博客标题)、_e(),输出文字到文档，例如_e(?你好?&#62;使用效果为输出“你好&#8221;二字，此函数不是必须的，只是在用来创建可以翻译的主题时使用
get_header() Wordpress主题系统用来包含header.php文件的函数
include (TEMPLATEPATH.&#8221;header.php&#8221;)用来包含文件
get_sidebar(),用于显示 wordpress 边栏
get_footer(),用于显示页脚,即footer.php文件
comments_template(),调用评论模板,需要创建comments.php文件
have_posts()判断你的博客是否有日志,举例:&#60;?php if(have_posts()) : ?&#62;
the_post()输出日志内容，the_title()输出日志标题,the_permalink()日志链接,the_content()输出博客内容。
使用方法：&#60;?php while(have_posts()) : the_post(); ?&#62;&#60;a href=?&#60;?php the_permalink(); ?&#62;?&#62;&#60;?php the_title(); ?&#62;&#60;/a&#62;&#60;?php endwhile; ?&#62;
the_category(),当前日志所在的所有类别。例如&#60;?php the_category(?, ?) ?&#62;，其中“，”用来区别分类别名。显示结果如此：Name of category 1,Name of category 2
the_author()用来输出当前日志作者的名字
comments_popup_link()调用一个弹出的留言窗口。（此功能必须在后台开启弹出留言的功能），如果没有激活，
comments_popup_link() 则只是简单的显示留言列表。例如&#60;?php comments_popup_link(?No Comments &#38;#187;?, ?1 Comment&#38;#187;?, ?% Comments &#38;#187;?); ?&#62;
No Comments &#38;#187;是在没有留言的时候显示的。1 Comment &#38;#187; 是用于当你刚好有1条留言时候。% Comments &#38;187; 是用于当你有多于一条留言的时候。比如：8 Comments 。百分号 % 用来显示数字。&#38;#187; 是用来显示一个双层箭头 ?。单篇日志查看模式下留言链接函数是不起作用的
edit_post_link(),显示日志编辑链接.这个只有当你以管理身份登录的时候（编辑者，Editor登录也可以）才可见.edit_post_link() 有三个参数。第一个是用来确定哪个词你将用在编辑链接的链接标题。第二个参数是用来显示在链接后面的字符。第三个参数是用于显示在编辑链接后面的字符。如:&#60;?php edit_post_link(&#8220;Edit&#8221;, &#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>收集下WP的一些函数列表方便<a href="http://www.yetlive.com">活着</a>在制作主题的时候使用。另外，Inove主题是一个可以参考的主题，能够找到许多的有用函数，功能强大能够帮助自己制作一款同样强大的主题。</p>
<p><span id="more-757"></span></p>
<p>bloginfo(),调用博客信息,函数参数有&#8217;name&#8217;(博客标题)、_e(),输出文字到文档，例如_e(?你好?&gt;使用效果为输出“你好&#8221;二字，此函数不是必须的，只是在用来创建可以翻译的主题时使用</p>
<p>get_header() Wordpress主题系统用来包含header.php文件的函数</p>
<p>include (TEMPLATEPATH.&#8221;header.php&#8221;)用来包含文件</p>
<p>get_sidebar(),用于显示 wordpress 边栏</p>
<p>get_footer(),用于显示页脚,即footer.php文件</p>
<p>comments_template(),调用评论模板,需要创建comments.php文件</p>
<p>have_posts()判断你的博客是否有日志,举例:&lt;?php if(have_posts()) : ?&gt;</p>
<p>the_post()输出日志内容，the_title()输出日志标题,the_permalink()日志链接,the_content()输出博客内容。</p>
<p>使用方法：&lt;?php while(have_posts()) : the_post(); ?&gt;&lt;a href=?&lt;?php the_permalink(); ?&gt;?&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;?php endwhile; ?&gt;</p>
<h3><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-weight: normal; color: #2a3845; line-height: 19px;">the_category(),当前日志所在的所有类别。例如&lt;?php the_category(?, ?) ?&gt;，其中“，”用来区别分类别名。显示结果如此：Name of category 1,Name of category 2</span></h3>
<p>the_author()用来输出当前日志作者的名字</p>
<p>comments_popup_link()调用一个弹出的留言窗口。（此功能必须在后台开启弹出留言的功能），如果没有激活，</p>
<p>comments_popup_link() 则只是简单的显示留言列表。例如&lt;?php comments_popup_link(?No Comments &amp;#187;?, ?1 Comment&amp;#187;?, ?% Comments &amp;#187;?); ?&gt;</p>
<p>No Comments &amp;#187;是在没有留言的时候显示的。1 Comment &amp;#187; 是用于当你刚好有1条留言时候。% Comments &amp;187; 是用于当你有多于一条留言的时候。比如：8 Comments 。百分号 % 用来显示数字。&amp;#187; 是用来显示一个双层箭头 ?。单篇日志查看模式下留言链接函数是不起作用的</p>
<p>edit_post_link(),显示日志编辑链接.这个只有当你以管理身份登录的时候（编辑者，Editor登录也可以）才可见.edit_post_link() 有三个参数。第一个是用来确定哪个词你将用在编辑链接的链接标题。第二个参数是用来显示在链接后面的字符。第三个参数是用于显示在编辑链接后面的字符。如:&lt;?php edit_post_link(&#8220;Edit&#8221;, &#8221; | &#8220;, ?); ?&gt;</p>
<p>the_ID()日志ID</p>
<p>wp_list_cats()调用wordpress分类链接列表,有三个参数.如&lt;?php wp_list_cats(&#8220;sort_column=name&amp;optioncount=1&amp;hierarchical=0&#8243;); ?&gt;,其中sort_column=name表示把分类按字符顺序排列,optioncount=1表示每个分类下面的日志数,hierarchial=0表示不把子分类放到子列表元素中.</p>
<p>get_calendar(),输出日历</p>
<p>wp_register(),注册</p>
<p>wp_loginout()登陆或退出</p>
<p>wp_meta(),元数据</p>
<p>previous_post_link(),next_post_link()分别显示上一篇与下一篇的链接.如&lt;?php previous_post_link(’&amp;laquo;%link‘) ?&gt;</p>
<p>page.php 模板文件定制函数</p>
<p>link_pages()显示子页面的链接,例如&lt;?php link_pages(?&lt;p&gt;&lt;strong&gt;Pages:&lt;/strong&gt; ?, ?&lt;/p&gt;?, ?number?); ?&gt;</p>
<p>在 page.php 中，在 &lt;?php the_content(); ?&gt; 输入以下代码：</p>
<p>&lt;?php link_pages(?&lt;p&gt;&lt;strong&gt;Pages:&lt;/strong&gt; ?, ?&lt;/p&gt;?, ?number?); ?&gt;</p>
<p>wp_list_pages(),显示页面列表,使用depth参数限制列表的层数.</p>
<p>get_links_list()显示友情链接</p>
<p>wp_get_archives(),用于显示文章归档列表,例如:wp_get_archives(&#8220;type=monthly&#8221;)</p>
<p>posts_nav_link()调用博客分页,示例:&lt;?php posts_nav_link(&#8220;in between&#8221;,&#8221;before&#8221;,&#8221;after&#8221;); ?&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yetlive.com/post/wordpress-function-list.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
