<?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>FVF.me&#039;Ye &#187; 主题</title>
	<atom:link href="http://fvf.me/tag/%e4%b8%bb%e9%a2%98/feed" rel="self" type="application/rss+xml" />
	<link>http://fvf.me</link>
	<description>我是孤独的根号5</description>
	<lastBuildDate>Mon, 19 Sep 2011 12:10:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>换主题了！</title>
		<link>http://fvf.me/diary/change-the-theme-of-the.html</link>
		<comments>http://fvf.me/diary/change-the-theme-of-the.html#comments</comments>
		<pubDate>Thu, 03 Sep 2009 04:55:17 +0000</pubDate>
		<dc:creator>死兔子</dc:creator>
				<category><![CDATA[小记]]></category>
		<category><![CDATA[主题]]></category>

		<guid isPermaLink="false">http://fvf.me/diary/%e6%8d%a2%e4%b8%bb%e9%a2%98%e4%ba%86%ef%bc%81.html</guid>
		<description><![CDATA[今天把主题个更新了，这个主题的思路和以前的一样，连整体的配色也差不多，只是把两栏变成了三栏，还增加了小图片来美化主题，象作者，标签，日期，分类之前的小图片可以增加一些主题的美感。以前由于在国外所以一直考虑速度的问题，主题尽量做得简单，不必要的图片都去掉了，现在博客回国了，速度提高了，开始提高艺术修养了，所以图片啊，js效果都来了。]]></description>
			<content:encoded><![CDATA[<p>今天把主题个更新了，这个主题的思路和以前的一样，连整体的配色也差不多，只是把两栏变成了三栏，还增加了小图片来美化主题，象作者，标签，日期，分类之前的小图片可以增加一些主题的美感。以前由于在国外所以一直考虑速度的问题，主题尽量做得简单，不必要的图片都去掉了，现在博客回国了，速度提高了，开始提高艺术修养了，所以图片啊，js效果都来了。</p>
]]></content:encoded>
			<wfw:commentRss>http://fvf.me/diary/change-the-theme-of-the.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Comment.php模板的制作详解</title>
		<link>http://fvf.me/translate/detailed-comment-php-production-template.html</link>
		<comments>http://fvf.me/translate/detailed-comment-php-production-template.html#comments</comments>
		<pubDate>Fri, 07 Aug 2009 02:58:09 +0000</pubDate>
		<dc:creator>死兔子</dc:creator>
				<category><![CDATA[翻译]]></category>
		<category><![CDATA[comment]]></category>
		<category><![CDATA[主题]]></category>

		<guid isPermaLink="false">http://fvf.me/diary/detailed-comment-php-production-template-2.html</guid>
		<description><![CDATA[其实对于改编主题的朋友来说其他的页面都很简单，唯一麻烦的就是评论页也就是Comments.php。因为这个页面对初学者来说太多php代码了。如果不搞懂会出现很多错误！ Nettuts+ 的作者 Gilles Maes 发表的一篇Unraveling the Secrets of WordPress' Comments.php File 详细的向你阐述wordpress主题文件中的comments.php文件。 下面就是我对上面的翻译，如果你的英文很好那么就直接点击上面去查看原文，如果英文不行的话，那么就看看我的译文吧，如有什么看不懂，请给我留言或点击查看英文原文。 如果只是为了参考本文，我制作了如下一个列表，文件你快速的跳到想参阅的部分： 页面的原生PHP代码 代码分析 防止直接访问comments.php文件 是否通过密码验证？ 显示评论 评论模板基本标签 最终结果 评论表单 条件语句预览 插入表单 一些小技巧 Gravatars 评论数 评论链接 编辑评论 评论的交互颜色 显示标签 评论的RSS链接 总结 1. 评论页面的原生PHP代码 &#60;?php if(!empty($_SERVER[&#39;SCRIPT_FILENAME&#39;]) &#38;&#38; &#39;comments.php&#39; == basename($_SERVER[&#39;SCRIPT_FILENAME&#39;])) : ?&#62;&#160; &#60;?php endif; ?&#62;&#160; &#160;&#160;&#160;&#160;&#160; &#60;?php if(!empty($post-&#62;post_password)) : ?&#62;&#160; &#160;&#160;&#160; &#60;?php if($_COOKIE[&#39;wp-postpass_&#39; [...]]]></description>
			<content:encoded><![CDATA[<p>其实对于改编主题的朋友来说其他的页面都很简单，唯一麻烦的就是评论页也就是Comments.php。因为这个页面对初学者来说太多php代码了。如果不搞懂会出现很多错误！  Nettuts+ 的作者 Gilles Maes 发表的一篇Unraveling the Secrets of WordPress' Comments.php File 详细的向你阐述wordpress主题文件中的comments.php文件。  下面就是我对上面的翻译，如果你的英文很好那么就直接点击上面去查看原文，如果英文不行的话，那么就看看我的译文吧，如有什么看不懂，请给我留言或点击查看英文原文。  <span id="more-63"></span>  如果只是为了参考本文，我制作了如下一个列表，文件你快速的跳到想参阅的部分：
<ol>
<li><a href="#php-backend">页面的原生PHP代码</a></li>
<li><a href="#general-code">代码分析</a>
<ol>
<li><a href="#prevent-direct-access">防止直接访问comments.php文件</a></li>
<li><a href="#password-required">是否通过密码验证？</a></li>
</ol>
</li>
<li><a href="#display-comments">显示评论</a>
<ol>
<li><a href="#comment-template-tags">评论模板基本标签</a></li>
<li><a href="#final-result">最终结果</a></li>
</ol>
</li>
<li><a href="#comment-form">评论表单</a>
<ol>
<li><a href="#conditional-statement-overview">条件语句预览</a></li>
<li><a href="#insert-form">插入表单</a></li>
</ol>
</li>
<li><a href="#little-tricks">一些小技巧 </a>
<ol>
<li><a href="#gravatars">Gravatars</a></li>
<li><a href="#comment-numbers">评论数</a></li>
<li><a href="#comment-links">评论链接</a></li>
<li><a href="#editing-comments">编辑评论</a></li>
<li><a href="#alternate-rows">评论的交互颜色</a></li>
<li><a href="#allowed-tags">显示标签</a></li>
<li><a href="#comment-rss">评论的RSS链接</a></li>
</ol>
</li>
<li><a href="#conclusion">总结</a></li>
</ol>
<h4 id="php-backend">1. 评论页面的原生PHP代码</h4>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(192, 192, 192); ">!</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">empty</span>(<span style="color: rgb(204, 204, 0); ">$_SERVER</span><span style="color: rgb(192, 192, 192); ">[</span><span style="color: rgb(187, 187, 0); ">&#39;SCRIPT_FILENAME&#39;</span><span style="color: rgb(192, 192, 192); ">])</span> <span style="color: rgb(192, 192, 192); ">&amp;&amp;</span> <span style="color: rgb(187, 187, 0); ">&#39;comments.php&#39;</span> <span style="color: rgb(192, 192, 192); ">==</span> <span style="color: rgb(192, 192, 192); ">basename</span>(<span style="color: rgb(204, 204, 0); ">$_SERVER</span><span style="color: rgb(192, 192, 192); ">[</span><span style="color: rgb(187, 187, 0); ">&#39;SCRIPT_FILENAME&#39;</span><span style="color: rgb(192, 192, 192); ">]))</span> <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(192, 192, 192); ">!</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">empty</span>(<span style="color: rgb(204, 204, 0); ">$post</span><span style="color: rgb(192, 192, 192); ">-&gt;</span><span style="color: rgb(255, 255, 0); ">post_password</span>)) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(204, 204, 0); ">$_COOKIE</span><span style="color: rgb(192, 192, 192); ">[</span><span style="color: rgb(187, 187, 0); ">&#39;wp-postpass_&#39;</span> <span style="color: rgb(192, 192, 192); ">.</span> <span style="color: rgb(192, 192, 192); ">COOKIEHASH</span><span style="color: rgb(192, 192, 192); ">]</span> <span style="color: rgb(192, 192, 192); ">!=</span> <span style="color: rgb(204, 204, 0); ">$post</span><span style="color: rgb(192, 192, 192); ">-&gt;</span><span style="color: rgb(255, 255, 0); ">post_password</span>) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp; <br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(204, 204, 0); ">$comments</span>) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">foreach</span>(<span style="color: rgb(204, 204, 0); ">$comments</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">as</span> <span style="color: rgb(204, 204, 0); ">$comment</span>) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span> (<span style="color: rgb(204, 204, 0); ">$comment</span><span style="color: rgb(192, 192, 192); ">-&gt;</span><span style="color: rgb(255, 255, 0); ">comment_approved</span> <span style="color: rgb(192, 192, 192); ">==</span> <span style="color: rgb(187, 187, 0); ">&#39;0&#39;</span>) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(192, 192, 192); ">&lt;</span><span style="color: rgb(192, 192, 192); "> ?php endforeach; ?&gt;&nbsp; </span><br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">else</span> <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp; <br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(192, 192, 192); ">comments_open</span>()) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(192, 192, 192); ">get_option</span>(<span style="color: rgb(187, 187, 0); ">&#39;comment_registration&#39;</span>) <span style="color: rgb(192, 192, 192); ">&amp;&amp;</span> <span style="color: rgb(192, 192, 192); ">!</span><span style="color: rgb(204, 204, 0); ">$user_ID</span>) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">else</span> <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(204, 204, 0); ">$user_ID</span>) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">else</span> <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">else</span> <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span></div>
<p>上面那段是是comments.php的最基础的PHP代码，对于新手来说，这些看起来有些吓人，但是请不要担心，看完本教程以后，你的思路会变得很清晰。</p>
<h4 id="php-backend">2. 代码分析</h4>
<h5 id="prevent-direct-access">1. 防止直接访问comments.php文件</h5>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(192, 192, 192); ">!</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">empty</span>(<span style="color: rgb(204, 204, 0); ">$_SERVER</span><span style="color: rgb(192, 192, 192); ">[</span><span style="color: rgb(187, 187, 0); ">&#39;SCRIPT_FILENAME&#39;</span><span style="color: rgb(192, 192, 192); ">])</span> <span style="color: rgb(192, 192, 192); ">&amp;&amp;</span> <span style="color: rgb(187, 187, 0); ">&#39;comments.php&#39;</span> <span style="color: rgb(192, 192, 192); ">==</span> <span style="color: rgb(192, 192, 192); ">basename</span>(<span style="color: rgb(204, 204, 0); ">$_SERVER</span><span style="color: rgb(192, 192, 192); ">[</span><span style="color: rgb(187, 187, 0); ">&#39;SCRIPT_FILENAME&#39;</span><span style="color: rgb(192, 192, 192); ">]))</span> <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span></div>
<p>  以上代码是用来防止用户意外直接访问comments.php文件。通常评论页面是被包含在日志页面之中，而不是单独存在的，因此这段代码也可以理解成是一个安全措施。在这些语句中，你可以添加任何你想向直接访问者提示的声明，通常是die陈述，为了帮助理解，我展示如下代码：</p>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(192, 192, 192); ">!</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">empty</span>(<span style="color: rgb(204, 204, 0); ">$_SERVER</span><span style="color: rgb(192, 192, 192); ">[</span><span style="color: rgb(187, 187, 0); ">&#39;SCRIPT_FILENAME&#39;</span><span style="color: rgb(192, 192, 192); ">])</span> <span style="color: rgb(192, 192, 192); ">&amp;&amp;</span> <span style="color: rgb(187, 187, 0); ">&#39;comments.php&#39;</span> <span style="color: rgb(192, 192, 192); ">==</span> <span style="color: rgb(192, 192, 192); ">basename</span>(<span style="color: rgb(204, 204, 0); ">$_SERVER</span><span style="color: rgb(192, 192, 192); ">[</span><span style="color: rgb(187, 187, 0); ">&#39;SCRIPT_FILENAME&#39;</span><span style="color: rgb(192, 192, 192); ">]))</span> <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">die</span>(<span style="color: rgb(187, 187, 0); ">&#39;You can not access this page directly!&#39;</span>); <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span></div>
<h5 id="password-required">2. 是否通过密码验证？</h5>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(192, 192, 192); ">!</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">empty</span>(<span style="color: rgb(204, 204, 0); ">$post</span><span style="color: rgb(192, 192, 192); ">-&gt;</span><span style="color: rgb(255, 255, 0); ">post_password</span>)) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(204, 204, 0); ">$_COOKIE</span><span style="color: rgb(192, 192, 192); ">[</span><span style="color: rgb(187, 187, 0); ">&#39;wp-postpass_&#39;</span> <span style="color: rgb(192, 192, 192); ">.</span> <span style="color: rgb(192, 192, 192); ">COOKIEHASH</span><span style="color: rgb(192, 192, 192); ">]</span> <span style="color: rgb(192, 192, 192); ">!=</span> <span style="color: rgb(204, 204, 0); ">$post</span><span style="color: rgb(192, 192, 192); ">-&gt;</span><span style="color: rgb(255, 255, 0); ">post_password</span>) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span></div>
<p>  这一段代码（这看上去是2段，实际上如果把它看作一段那更有意义）是用来检验用户是否通过密码验证，具备足够的权限来阅读日志和评论，显然，如果你没有阅读日志的权限，那么自然没有查看和参与评论的权限。</p>
<p>上述代码的第一个if是用来检测是否存在密码设置。第二个if是用来检测是否存在一个包含密码的cookie文件，如果不存在就显示错误信息。你可以在第二个if句块的任意位置自定义这些错误信息。</p>
<h4 id="display-comments">3. 显示评论</h4>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(204, 204, 0); ">$comments</span>)<span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">foreach</span> (<span style="color: rgb(204, 204, 0); ">$comments</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">as</span> <span style="color: rgb(204, 204, 0); ">$comment</span>) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span> (<span style="color: rgb(204, 204, 0); ">$comment</span><span style="color: rgb(192, 192, 192); ">-&gt;</span><span style="color: rgb(255, 255, 0); ">comment_approved</span> <span style="color: rgb(192, 192, 192); ">==</span> <span style="color: rgb(187, 187, 0); ">&#39;0&#39;</span>) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endforeach</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">else</span> <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span></div>
<p>  第一个条件语句(if($comments))是用来检测是否存在评论，如果存在的话，就按照foreach语句指定的方式循环显示每一条评论，直至结束。在foreach语句块中，你会发现有这么一个条件语句：if($comment-&gt;comment_approved ==‘0′)这是用来检测评论是否通过了审核，假如没通过审核就会提示错误信息。</p>
<p>举例如下：</p>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(204, 204, 0); ">$comments</span>) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;ol&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">foreach</span>(<span style="color: rgb(204, 204, 0); ">$comments</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">as</span> <span style="color: rgb(204, 204, 0); ">$comment</span>) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;li&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(204, 204, 0); ">$comment</span><span style="color: rgb(192, 192, 192); ">-&gt;</span><span style="color: rgb(255, 255, 0); ">comment_approved</span> <span style="color: rgb(192, 192, 192); ">==</span> <span style="color: rgb(187, 187, 0); ">&#39;0&#39;</span>) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;p&gt;</span><span style="color: rgb(192, 192, 192); ">Your comment is awaiting approval</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/p&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;p&gt;</span><span style="color: rgb(192, 192, 192); ">Your comment</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/p&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/li&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endforeach</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/ol&gt;</span>&nbsp; <br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">else</span> <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;p&gt;</span><span style="color: rgb(192, 192, 192); ">No comments</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/p&gt;</span>&nbsp; <br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span></div>
<h5 id="comment-template-tags">1. 评论模板基本标签</h5>
<p>您需要使用Wordpress提供的预定义标签，来给评论页面添加一些功能。</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="231" valign="top">模板标签</td>
<td width="327" valign="top">描述</td>
</tr>
<tr>
<td width="231" valign="top">&lt;?php comment_ID(); ?&gt;</td>
<td width="327" valign="top">评论的ID</td>
</tr>
<tr>
<td width="231" valign="top">&lt;?php comment_author(); ?&gt;</td>
<td width="327" valign="top">评论的作者</td>
</tr>
<tr>
<td width="231" valign="top">&lt;?php comment_author_link(); ?&gt;</td>
<td width="327" valign="top">评论者的链接</td>
</tr>
<tr>
<td width="231" valign="top">&lt;?php comment_type(); ?&gt;</td>
<td width="327" valign="top">评论的类别，pingback,trackback或者是一个单纯的评论</td>
</tr>
<tr>
<td width="231" valign="top">&lt;?php comment_text(); ?&gt;</td>
<td width="327" valign="top">评论内容</td>
</tr>
<tr>
<td width="231" valign="top">&lt;?php comment_date(); ?&gt;</td>
<td width="327" valign="top">评论的日期</td>
</tr>
<tr>
<td width="231" valign="top">&lt;?php comment_time(); ?&gt;</td>
<td width="327" valign="top">评论的时间</td>
</tr>
</tbody>
</table>
<h5 id="#final-result">2. 最终结果</h5>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(204, 204, 0); ">$comments</span>) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;ol&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">foreach</span>(<span style="color: rgb(204, 204, 0); ">$comments</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">as</span> <span style="color: rgb(204, 204, 0); ">$comment</span>) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;li</span> <span style="color: rgb(255, 255, 0); ">id=</span><span style="color: rgb(187, 187, 0); ">&quot;comment-</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(192, 192, 192); ">comment_ID</span>(); <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(187, 187, 0); ">&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span> (<span style="color: rgb(204, 204, 0); ">$comment</span><span style="color: rgb(192, 192, 192); ">-&gt;</span><span style="color: rgb(255, 255, 0); ">comment_approved</span> <span style="color: rgb(192, 192, 192); ">==</span> <span style="color: rgb(187, 187, 0); ">&#39;0&#39;</span>) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;p&gt;</span><span style="color: rgb(192, 192, 192); ">Your comment is awaiting approval</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/p&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(192, 192, 192); ">comment_text</span>(); <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;cite&gt;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(192, 192, 192); ">comment_type</span>(); <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(192, 192, 192); "> by </span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(192, 192, 192); ">comment_author_link</span>(); <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(192, 192, 192); "> on </span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(192, 192, 192); ">comment_date</span>(); <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(192, 192, 192); "> at </span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(192, 192, 192); ">comment_time</span>(); <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/cite&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/li&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endforeach</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/ol&gt;</span>&nbsp; <br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">else</span> <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;p&gt;</span><span style="color: rgb(192, 192, 192); ">No comments yet</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/p&gt;</span>&nbsp; <br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span></div>
<p>  把这段代码插入到你的 comments.php 文件中，这样你就有一个评论的有序列表，并且显示你定义的内容。</p>
<h4 id="comment-form">4. 评论表单</h4>
<p>现在我们开始进入到评论表单部分的处理，评论表单皮肤的定制算是 comments.php文件中的一个难点。</p>
<p>你也许会被众多的语句吓到了，比如“你已经登陆，请……”，这些往往给新手造成了困扰：错误的标签放置可能造成整个评论表单失效，而这往往并不是PHP语法上的错误。</p>
<p>为了让你尽快的对评论表单有一个全面的认识，我接下来要详细讲解这些语句块，并且对HTML代码也做了相应介绍，让你明白为什么它们会出现在这个位置。</p>
<h5 id="conditional-statement-overview">1. 条件语句预览</h5>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(192, 192, 192); ">comments_open</span>()) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(192, 192, 192); ">get_option</span>(<span style="color: rgb(187, 187, 0); ">&#39;comment_registration&#39;</span>) <span style="color: rgb(192, 192, 192); ">&amp;&amp;</span> <span style="color: rgb(192, 192, 192); ">!</span><span style="color: rgb(204, 204, 0); ">$user_ID</span>) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">else</span> <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(204, 204, 0); ">$user_ID</span>) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">else</span> <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">else</span> <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span></div>
<p>  我们碰到的第一个条件语句是 。这个函数主要目的是为了检测日志是否允许评论。很显然，如果该日志是不允许评论状态，那么你就不能发表评论，也就是说完全没有必要显示评论表单。当关闭评论后，你可以放置一些提示信息于上述代码最后两个标签 和 之间，以便让访问者知道。</p>
<p>第二个条件语句是 () 。这个函数是用来检测你是否要注册后才能评论以及目前是否登陆了帐号。如果上面的两个条件都不满足，那么访问者就会被引导到登陆页面。假如博客的主人设置为不用注册即可发表评论，或者是你已经登陆，那么就将接着执行 else 部分并显示出评论表单。</p>
<p>最后一个条件语句是用来检测你否已经登出帐号。此检查的目的很简单，假如你已经登陆了，那么评论表单就不会显示姓名、Email、主页地址等填写项，因为对于已登陆的用户来说这是没有实在意义的。</p>
<h5 id="insert-form">2. 插入表单</h5>
<p>我们已经分析完 coments.php 文件中的所有条件语句，接下来可以插入评论表单。</p>
<p>我猜你肯定首先想到的是：在哪开始插入表单？不要紧张，不妨凭感觉走 第二个条件语句是用来检测你是否已经登陆，因此你至少要在这个判断条件之后才能插入表单，这样我们也就确定了评论表单的位置。</p>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(192, 192, 192); ">comments_open</span>()) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(192, 192, 192); ">get_option</span>(<span style="color: rgb(187, 187, 0); ">&#39;comment_registration&#39;</span>) <span style="color: rgb(192, 192, 192); ">&amp;&amp;</span> <span style="color: rgb(192, 192, 192); ">!</span><span style="color: rgb(204, 204, 0); ">$user_ID</span>) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;p&gt;</span><span style="color: rgb(192, 192, 192); ">You must be </span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;a</span> <span style="color: rgb(255, 255, 0); ">href=</span><span style="color: rgb(187, 187, 0); ">&quot;&amp;lt;?php echo get_option(&#39;siteurl&#39;); ?&amp;gt;/wp-login.php?redirect_to=&amp;lt; ?php echo urlencode(get_permalink()); ?&amp;gt;&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;</span><span style="color: rgb(192, 192, 192); ">logged in</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/a&gt;</span><span style="color: rgb(192, 192, 192); "> to post a comment.</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/p&gt;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">else</span> <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;form</span> <span style="color: rgb(255, 255, 0); ">action=</span><span style="color: rgb(187, 187, 0); ">&quot;&amp;lt;?php echo get_option(&#39;siteurl&#39;); ?&amp;gt;/wp-comments-post.php&quot;</span> <span style="color: rgb(255, 255, 0); ">method=</span><span style="color: rgb(187, 187, 0); ">&quot;post&quot;</span> <span style="color: rgb(255, 255, 0); ">id=</span><span style="color: rgb(187, 187, 0); ">&quot;commentform&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(204, 204, 0); ">$user_ID</span>) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">else</span> <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/form&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">else</span> <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;p&gt;</span><span style="color: rgb(192, 192, 192); ">The comments are closed.</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/p&gt;</span>&nbsp; <br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span></div>
<p>  我还插入了登陆页面的链接，这只是我在默认的 comments.php 文件中发现的。就像我之前说的那样，最后一个条件句是用来判断你是否登陆。因此，姓名、Email、主页地址只在你没有登陆时才有必要显示。因此我们可以在那个位置插入这些东西。</p>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(192, 192, 192); ">comments_open</span>()) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(192, 192, 192); ">get_option</span>(<span style="color: rgb(187, 187, 0); ">&#39;comment_registration&#39;</span>) <span style="color: rgb(192, 192, 192); ">&amp;&amp;</span> <span style="color: rgb(192, 192, 192); ">!</span><span style="color: rgb(204, 204, 0); ">$user_ID</span>) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;p&gt;</span><span style="color: rgb(192, 192, 192); ">You must be </span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;a</span> <span style="color: rgb(255, 255, 0); ">href=</span><span style="color: rgb(187, 187, 0); ">&quot;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(192, 192, 192); ">get_option</span>(<span style="color: rgb(187, 187, 0); ">&#39;siteurl&#39;</span>); <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(187, 187, 0); ">/wp-login.php?redirect_to=</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(192, 192, 192); ">urlencode</span>(<span style="color: rgb(192, 192, 192); ">get_permalink</span>()); <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(187, 187, 0); ">&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;</span><span style="color: rgb(192, 192, 192); ">logged in</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/a&gt;</span><span style="color: rgb(192, 192, 192); "> to post a comment.</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/p&gt;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">else</span> <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;form</span> <span style="color: rgb(255, 255, 0); ">action=</span><span style="color: rgb(187, 187, 0); ">&quot;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(192, 192, 192); ">get_option</span>(<span style="color: rgb(187, 187, 0); ">&#39;siteurl&#39;</span>); <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(187, 187, 0); ">/wp-comments-post.php&quot;</span> <span style="color: rgb(255, 255, 0); ">method=</span><span style="color: rgb(187, 187, 0); ">&quot;post&quot;</span> <span style="color: rgb(255, 255, 0); ">id=</span><span style="color: rgb(187, 187, 0); ">&quot;commentform&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(204, 204, 0); ">$user_ID</span>) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;p&gt;</span><span style="color: rgb(192, 192, 192); ">Logged in as </span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;a</span> <span style="color: rgb(255, 255, 0); ">href=</span><span style="color: rgb(187, 187, 0); ">&quot;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(192, 192, 192); ">get_option</span>(<span style="color: rgb(187, 187, 0); ">&#39;siteurl&#39;</span>); <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(187, 187, 0); ">/wp-admin/profile.php&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(204, 204, 0); ">$user_identity</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/a&gt;</span><span style="color: rgb(192, 192, 192); ">. </span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;a</span> <span style="color: rgb(255, 255, 0); ">href=</span><span style="color: rgb(187, 187, 0); ">&quot;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(192, 192, 192); ">get_option</span>(<span style="color: rgb(187, 187, 0); ">&#39;siteurl&#39;</span>); <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(187, 187, 0); ">/wp-login.php?action=logout&quot;</span> <span style="color: rgb(255, 255, 0); ">title=</span><span style="color: rgb(187, 187, 0); ">&quot;Log out of this account&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;</span><span style="color: rgb(192, 192, 192); ">Log out </span><span style="color: rgb(255, 255, 255); ">&amp;raquo;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/a&gt;&lt;/p&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">else</span> <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;p&gt;&lt;input</span> <span style="color: rgb(255, 255, 0); ">type=</span><span style="color: rgb(187, 187, 0); ">&quot;text&quot;</span> <span style="color: rgb(255, 255, 0); ">name=</span><span style="color: rgb(187, 187, 0); ">&quot;author&quot;</span> <span style="color: rgb(255, 255, 0); ">id=</span><span style="color: rgb(187, 187, 0); ">&quot;author&quot;</span> <span style="color: rgb(255, 255, 0); ">value=</span><span style="color: rgb(187, 187, 0); ">&quot;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(204, 204, 0); ">$comment_author</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(187, 187, 0); ">&quot;</span> <span style="color: rgb(255, 255, 0); ">size=</span><span style="color: rgb(187, 187, 0); ">&quot;22&quot;</span> <span style="color: rgb(255, 255, 0); ">tabindex=</span><span style="color: rgb(187, 187, 0); ">&quot;1&quot;</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">/&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;label</span> <span style="color: rgb(255, 255, 0); ">for=</span><span style="color: rgb(187, 187, 0); ">&quot;author&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;&lt;small&gt;</span><span style="color: rgb(192, 192, 192); ">Name </span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(204, 204, 0); ">$req</span>) <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(187, 187, 0); ">&quot;(required)&quot;</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/small&gt;&lt;/label&gt;&lt;/p&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;p&gt;&lt;input</span> <span style="color: rgb(255, 255, 0); ">type=</span><span style="color: rgb(187, 187, 0); ">&quot;text&quot;</span> <span style="color: rgb(255, 255, 0); ">name=</span><span style="color: rgb(187, 187, 0); ">&quot;email&quot;</span> <span style="color: rgb(255, 255, 0); ">id=</span><span style="color: rgb(187, 187, 0); ">&quot;email&quot;</span> <span style="color: rgb(255, 255, 0); ">value=</span><span style="color: rgb(187, 187, 0); ">&quot;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(204, 204, 0); ">$comment_author_email</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(187, 187, 0); ">&quot;</span> <span style="color: rgb(255, 255, 0); ">size=</span><span style="color: rgb(187, 187, 0); ">&quot;22&quot;</span> <span style="color: rgb(255, 255, 0); ">tabindex=</span><span style="color: rgb(187, 187, 0); ">&quot;2&quot;</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">/&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;label</span> <span style="color: rgb(255, 255, 0); ">for=</span><span style="color: rgb(187, 187, 0); ">&quot;email&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;&lt;small&gt;</span><span style="color: rgb(192, 192, 192); ">Mail (will not be published) </span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(204, 204, 0); ">$req</span>) <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(187, 187, 0); ">&quot;(required)&quot;</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/small&gt;&lt;/label&gt;&lt;/p&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;p&gt;&lt;input</span> <span style="color: rgb(255, 255, 0); ">type=</span><span style="color: rgb(187, 187, 0); ">&quot;text&quot;</span> <span style="color: rgb(255, 255, 0); ">name=</span><span style="color: rgb(187, 187, 0); ">&quot;url&quot;</span> <span style="color: rgb(255, 255, 0); ">id=</span><span style="color: rgb(187, 187, 0); ">&quot;url&quot;</span> <span style="color: rgb(255, 255, 0); ">value=</span><span style="color: rgb(187, 187, 0); ">&quot;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(204, 204, 0); ">$comment_author_url</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(187, 187, 0); ">&quot;</span> <span style="color: rgb(255, 255, 0); ">size=</span><span style="color: rgb(187, 187, 0); ">&quot;22&quot;</span> <span style="color: rgb(255, 255, 0); ">tabindex=</span><span style="color: rgb(187, 187, 0); ">&quot;3&quot;</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">/&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;label</span> <span style="color: rgb(255, 255, 0); ">for=</span><span style="color: rgb(187, 187, 0); ">&quot;url&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;&lt;small&gt;</span><span style="color: rgb(192, 192, 192); ">Website</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/small&gt;&lt;/label&gt;&lt;/p&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/form&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">else</span> <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;p&gt;</span><span style="color: rgb(192, 192, 192); ">The comments are closed.</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/p&gt;</span>&nbsp; <br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span></div>
<p>  非常棒！我们只需要插入一些简单的代码，比如文件域和提交按钮，把这些通通播入到最后一个判断语句块的后面，因为这些元素跟你有没有登陆是不相干的。</p>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(192, 192, 192); ">comments_open</span>()) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(192, 192, 192); ">get_option</span>(<span style="color: rgb(187, 187, 0); ">&#39;comment_registration&#39;</span>) <span style="color: rgb(192, 192, 192); ">&amp;&amp;</span> <span style="color: rgb(192, 192, 192); ">!</span><span style="color: rgb(204, 204, 0); ">$user_ID</span>) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;p&gt;</span><span style="color: rgb(192, 192, 192); ">You must be </span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;a</span> <span style="color: rgb(255, 255, 0); ">href=</span><span style="color: rgb(187, 187, 0); ">&quot;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(192, 192, 192); ">get_option</span>(<span style="color: rgb(187, 187, 0); ">&#39;siteurl&#39;</span>); <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(187, 187, 0); ">/wp-login.php?redirect_to=</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(192, 192, 192); ">urlencode</span>(<span style="color: rgb(192, 192, 192); ">get_permalink</span>()); <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(187, 187, 0); ">&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;</span><span style="color: rgb(192, 192, 192); ">logged in</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/a&gt;</span><span style="color: rgb(192, 192, 192); "> to post a comment.</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/p&gt;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">else</span> <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;form</span> <span style="color: rgb(255, 255, 0); ">action=</span><span style="color: rgb(187, 187, 0); ">&quot;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(192, 192, 192); ">get_option</span>(<span style="color: rgb(187, 187, 0); ">&#39;siteurl&#39;</span>); <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(187, 187, 0); ">/wp-comments-post.php&quot;</span> <span style="color: rgb(255, 255, 0); ">method=</span><span style="color: rgb(187, 187, 0); ">&quot;post&quot;</span> <span style="color: rgb(255, 255, 0); ">id=</span><span style="color: rgb(187, 187, 0); ">&quot;commentform&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(204, 204, 0); ">$user_ID</span>) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;p&gt;</span><span style="color: rgb(192, 192, 192); ">Logged in as </span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;a</span> <span style="color: rgb(255, 255, 0); ">href=</span><span style="color: rgb(187, 187, 0); ">&quot;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(192, 192, 192); ">get_option</span>(<span style="color: rgb(187, 187, 0); ">&#39;siteurl&#39;</span>); <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(187, 187, 0); ">/wp-admin/profile.php&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(204, 204, 0); ">$user_identity</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/a&gt;</span><span style="color: rgb(192, 192, 192); ">. </span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;a</span> <span style="color: rgb(255, 255, 0); ">href=</span><span style="color: rgb(187, 187, 0); ">&quot;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(192, 192, 192); ">get_option</span>(<span style="color: rgb(187, 187, 0); ">&#39;siteurl&#39;</span>); <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(187, 187, 0); ">/wp-login.php?action=logout&quot;</span> <span style="color: rgb(255, 255, 0); ">title=</span><span style="color: rgb(187, 187, 0); ">&quot;Log out of this account&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;</span><span style="color: rgb(192, 192, 192); ">Log out </span><span style="color: rgb(255, 255, 255); ">&amp;raquo;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/a&gt;&lt;/p&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">else</span> <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;p&gt;&lt;input</span> <span style="color: rgb(255, 255, 0); ">type=</span><span style="color: rgb(187, 187, 0); ">&quot;text&quot;</span> <span style="color: rgb(255, 255, 0); ">name=</span><span style="color: rgb(187, 187, 0); ">&quot;author&quot;</span> <span style="color: rgb(255, 255, 0); ">id=</span><span style="color: rgb(187, 187, 0); ">&quot;author&quot;</span> <span style="color: rgb(255, 255, 0); ">value=</span><span style="color: rgb(187, 187, 0); ">&quot;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(204, 204, 0); ">$comment_author</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(187, 187, 0); ">&quot;</span> <span style="color: rgb(255, 255, 0); ">size=</span><span style="color: rgb(187, 187, 0); ">&quot;22&quot;</span> <span style="color: rgb(255, 255, 0); ">tabindex=</span><span style="color: rgb(187, 187, 0); ">&quot;1&quot;</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">/&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;label</span> <span style="color: rgb(255, 255, 0); ">for=</span><span style="color: rgb(187, 187, 0); ">&quot;author&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;&lt;small&gt;</span><span style="color: rgb(192, 192, 192); ">Name </span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(204, 204, 0); ">$req</span>) <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(187, 187, 0); ">&quot;(required)&quot;</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/small&gt;&lt;/label&gt;&lt;/p&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;p&gt;&lt;input</span> <span style="color: rgb(255, 255, 0); ">type=</span><span style="color: rgb(187, 187, 0); ">&quot;text&quot;</span> <span style="color: rgb(255, 255, 0); ">name=</span><span style="color: rgb(187, 187, 0); ">&quot;email&quot;</span> <span style="color: rgb(255, 255, 0); ">id=</span><span style="color: rgb(187, 187, 0); ">&quot;email&quot;</span> <span style="color: rgb(255, 255, 0); ">value=</span><span style="color: rgb(187, 187, 0); ">&quot;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(204, 204, 0); ">$comment_author_email</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(187, 187, 0); ">&quot;</span> <span style="color: rgb(255, 255, 0); ">size=</span><span style="color: rgb(187, 187, 0); ">&quot;22&quot;</span> <span style="color: rgb(255, 255, 0); ">tabindex=</span><span style="color: rgb(187, 187, 0); ">&quot;2&quot;</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">/&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;label</span> <span style="color: rgb(255, 255, 0); ">for=</span><span style="color: rgb(187, 187, 0); ">&quot;email&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;&lt;small&gt;</span><span style="color: rgb(192, 192, 192); ">Mail (will not be published) </span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(204, 204, 0); ">$req</span>) <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(187, 187, 0); ">&quot;(required)&quot;</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/small&gt;&lt;/label&gt;&lt;/p&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;p&gt;&lt;input</span> <span style="color: rgb(255, 255, 0); ">type=</span><span style="color: rgb(187, 187, 0); ">&quot;text&quot;</span> <span style="color: rgb(255, 255, 0); ">name=</span><span style="color: rgb(187, 187, 0); ">&quot;url&quot;</span> <span style="color: rgb(255, 255, 0); ">id=</span><span style="color: rgb(187, 187, 0); ">&quot;url&quot;</span> <span style="color: rgb(255, 255, 0); ">value=</span><span style="color: rgb(187, 187, 0); ">&quot;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(204, 204, 0); ">$comment_author_url</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(187, 187, 0); ">&quot;</span> <span style="color: rgb(255, 255, 0); ">size=</span><span style="color: rgb(187, 187, 0); ">&quot;22&quot;</span> <span style="color: rgb(255, 255, 0); ">tabindex=</span><span style="color: rgb(187, 187, 0); ">&quot;3&quot;</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">/&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;label</span> <span style="color: rgb(255, 255, 0); ">for=</span><span style="color: rgb(187, 187, 0); ">&quot;url&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;&lt;small&gt;</span><span style="color: rgb(192, 192, 192); ">Website</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/small&gt;&lt;/label&gt;&lt;/p&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;p&gt;&lt;textarea</span> <span style="color: rgb(255, 255, 0); ">name=</span><span style="color: rgb(187, 187, 0); ">&quot;comment&quot;</span> <span style="color: rgb(255, 255, 0); ">id=</span><span style="color: rgb(187, 187, 0); ">&quot;comment&quot;</span> <span style="color: rgb(255, 255, 0); ">cols=</span><span style="color: rgb(187, 187, 0); ">&quot;100%&quot;</span> <span style="color: rgb(255, 255, 0); ">rows=</span><span style="color: rgb(187, 187, 0); ">&quot;10&quot;</span> <span style="color: rgb(255, 255, 0); ">tabindex=</span><span style="color: rgb(187, 187, 0); ">&quot;4&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;&lt;/textarea&gt;&lt;/p&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;p&gt;&lt;input</span> <span style="color: rgb(255, 255, 0); ">name=</span><span style="color: rgb(187, 187, 0); ">&quot;submit&quot;</span> <span style="color: rgb(255, 255, 0); ">type=</span><span style="color: rgb(187, 187, 0); ">&quot;submit&quot;</span> <span style="color: rgb(255, 255, 0); ">id=</span><span style="color: rgb(187, 187, 0); ">&quot;submit&quot;</span> <span style="color: rgb(255, 255, 0); ">tabindex=</span><span style="color: rgb(187, 187, 0); ">&quot;5&quot;</span> <span style="color: rgb(255, 255, 0); ">value=</span><span style="color: rgb(187, 187, 0); ">&quot;Submit Comment&quot;</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">/&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;input</span> <span style="color: rgb(255, 255, 0); ">type=</span><span style="color: rgb(187, 187, 0); ">&quot;hidden&quot;</span> <span style="color: rgb(255, 255, 0); ">name=</span><span style="color: rgb(187, 187, 0); ">&quot;comment_post_ID&quot;</span> <span style="color: rgb(255, 255, 0); ">value=</span><span style="color: rgb(187, 187, 0); ">&quot;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(204, 204, 0); ">$id</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(187, 187, 0); ">&quot;</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">/&gt;&lt;/p&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(192, 192, 192); ">do_action</span>(<span style="color: rgb(187, 187, 0); ">&#39;comment_form&#39;</span><span style="color: rgb(192, 192, 192); ">,</span> <span style="color: rgb(204, 204, 0); ">$post</span><span style="color: rgb(192, 192, 192); ">-&gt;</span><span style="color: rgb(255, 255, 0); ">ID</span>); <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/form&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">else</span> <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;p&gt;</span><span style="color: rgb(192, 192, 192); ">The comments are closed.</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/p&gt;</span>&nbsp; <br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span></div>
<p>  这些代码简洁明了，不言自明：一个文本域、一个提交按钮，还有一个由评论的 future ID 控制的隐藏的输入区域，最后是一个PHP小代码段</p>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(192, 192, 192); ">comments_open</span>()) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(192, 192, 192); ">get_option</span>(<span style="color: rgb(187, 187, 0); ">&#39;comment_registration&#39;</span>) <span style="color: rgb(192, 192, 192); ">&amp;&amp;</span> <span style="color: rgb(192, 192, 192); ">!</span><span style="color: rgb(204, 204, 0); ">$user_ID</span>) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;p&gt;</span><span style="color: rgb(192, 192, 192); ">You must be </span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;a</span> <span style="color: rgb(255, 255, 0); ">href=</span><span style="color: rgb(187, 187, 0); ">&quot;&amp;lt;?php echo get_option(&#39;siteurl&#39;); ?&amp;gt;/wp-login.php?redirect_to=&amp;lt; ?php echo urlencode(get_permalink()); ?&amp;gt;&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;</span><span style="color: rgb(192, 192, 192); ">logged in</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/a&gt;</span><span style="color: rgb(192, 192, 192); "> to post a comment.</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/p&gt;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">else</span> <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;form</span> <span style="color: rgb(255, 255, 0); ">action=</span><span style="color: rgb(187, 187, 0); ">&quot;&amp;lt;?php echo get_option(&#39;siteurl&#39;); ?&amp;gt;/wp-comments-post.php&quot;</span> <span style="color: rgb(255, 255, 0); ">method=</span><span style="color: rgb(187, 187, 0); ">&quot;post&quot;</span> <span style="color: rgb(255, 255, 0); ">id=</span><span style="color: rgb(187, 187, 0); ">&quot;commentform&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(204, 204, 0); ">$user_ID</span>) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;p&gt;</span><span style="color: rgb(192, 192, 192); ">Logged in as </span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;a</span> <span style="color: rgb(255, 255, 0); ">href=</span><span style="color: rgb(187, 187, 0); ">&quot;&amp;lt;?php echo get_option(&#39;siteurl&#39;); ?&amp;gt;/wp-admin/profile.php&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(204, 204, 0); ">$user_identity</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/a&gt;</span><span style="color: rgb(192, 192, 192); ">. </span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;a</span> <span style="color: rgb(255, 255, 0); ">href=</span><span style="color: rgb(187, 187, 0); ">&quot;&amp;lt;?php echo get_option(&#39;siteurl&#39;); ?&amp;gt;/wp-login.php?action=logout&quot;</span> <span style="color: rgb(255, 255, 0); ">title=</span><span style="color: rgb(187, 187, 0); ">&quot;Log out of this account&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;</span><span style="color: rgb(192, 192, 192); ">Log out </span><span style="color: rgb(255, 255, 255); ">&amp;raquo;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/a&gt;&lt;/p&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">else</span> <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;p&gt;&lt;input</span> <span style="color: rgb(255, 255, 0); ">type=</span><span style="color: rgb(187, 187, 0); ">&quot;text&quot;</span> <span style="color: rgb(255, 255, 0); ">name=</span><span style="color: rgb(187, 187, 0); ">&quot;author&quot;</span> <span style="color: rgb(255, 255, 0); ">id=</span><span style="color: rgb(187, 187, 0); ">&quot;author&quot;</span> <span style="color: rgb(255, 255, 0); ">value=</span><span style="color: rgb(187, 187, 0); ">&quot;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(204, 204, 0); ">$comment_author</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(187, 187, 0); ">&quot;</span> <span style="color: rgb(255, 255, 0); ">size=</span><span style="color: rgb(187, 187, 0); ">&quot;22&quot;</span> <span style="color: rgb(255, 255, 0); ">tabindex=</span><span style="color: rgb(187, 187, 0); ">&quot;1&quot;</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">/&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;label</span> <span style="color: rgb(255, 255, 0); ">for=</span><span style="color: rgb(187, 187, 0); ">&quot;author&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;&lt;small&gt;</span><span style="color: rgb(192, 192, 192); ">Name </span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(204, 204, 0); ">$req</span>) <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(187, 187, 0); ">&quot;(required)&quot;</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/small&gt;&lt;/label&gt;&lt;/p&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;p&gt;&lt;input</span> <span style="color: rgb(255, 255, 0); ">type=</span><span style="color: rgb(187, 187, 0); ">&quot;text&quot;</span> <span style="color: rgb(255, 255, 0); ">name=</span><span style="color: rgb(187, 187, 0); ">&quot;email&quot;</span> <span style="color: rgb(255, 255, 0); ">id=</span><span style="color: rgb(187, 187, 0); ">&quot;email&quot;</span> <span style="color: rgb(255, 255, 0); ">value=</span><span style="color: rgb(187, 187, 0); ">&quot;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(204, 204, 0); ">$comment_author_email</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(187, 187, 0); ">&quot;</span> <span style="color: rgb(255, 255, 0); ">size=</span><span style="color: rgb(187, 187, 0); ">&quot;22&quot;</span> <span style="color: rgb(255, 255, 0); ">tabindex=</span><span style="color: rgb(187, 187, 0); ">&quot;2&quot;</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">/&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;label</span> <span style="color: rgb(255, 255, 0); ">for=</span><span style="color: rgb(187, 187, 0); ">&quot;email&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;&lt;small&gt;</span><span style="color: rgb(192, 192, 192); ">Mail (will not be published) </span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(204, 204, 0); ">$req</span>) <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(187, 187, 0); ">&quot;(required)&quot;</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/small&gt;&lt;/label&gt;&lt;/p&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;p&gt;&lt;input</span> <span style="color: rgb(255, 255, 0); ">type=</span><span style="color: rgb(187, 187, 0); ">&quot;text&quot;</span> <span style="color: rgb(255, 255, 0); ">name=</span><span style="color: rgb(187, 187, 0); ">&quot;url&quot;</span> <span style="color: rgb(255, 255, 0); ">id=</span><span style="color: rgb(187, 187, 0); ">&quot;url&quot;</span> <span style="color: rgb(255, 255, 0); ">value=</span><span style="color: rgb(187, 187, 0); ">&quot;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(204, 204, 0); ">$comment_author_url</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(187, 187, 0); ">&quot;</span> <span style="color: rgb(255, 255, 0); ">size=</span><span style="color: rgb(187, 187, 0); ">&quot;22&quot;</span> <span style="color: rgb(255, 255, 0); ">tabindex=</span><span style="color: rgb(187, 187, 0); ">&quot;3&quot;</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">/&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;label</span> <span style="color: rgb(255, 255, 0); ">for=</span><span style="color: rgb(187, 187, 0); ">&quot;url&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;&lt;small&gt;</span><span style="color: rgb(192, 192, 192); ">Website</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/small&gt;&lt;/label&gt;&lt;/p&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;p&gt;&lt;textarea</span> <span style="color: rgb(255, 255, 0); ">name=</span><span style="color: rgb(187, 187, 0); ">&quot;comment&quot;</span> <span style="color: rgb(255, 255, 0); ">id=</span><span style="color: rgb(187, 187, 0); ">&quot;comment&quot;</span> <span style="color: rgb(255, 255, 0); ">cols=</span><span style="color: rgb(187, 187, 0); ">&quot;100%&quot;</span> <span style="color: rgb(255, 255, 0); ">rows=</span><span style="color: rgb(187, 187, 0); ">&quot;10&quot;</span> <span style="color: rgb(255, 255, 0); ">tabindex=</span><span style="color: rgb(187, 187, 0); ">&quot;4&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;&lt;/textarea&gt;&lt;/p&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;p&gt;&lt;input</span> <span style="color: rgb(255, 255, 0); ">name=</span><span style="color: rgb(187, 187, 0); ">&quot;submit&quot;</span> <span style="color: rgb(255, 255, 0); ">type=</span><span style="color: rgb(187, 187, 0); ">&quot;submit&quot;</span> <span style="color: rgb(255, 255, 0); ">id=</span><span style="color: rgb(187, 187, 0); ">&quot;submit&quot;</span> <span style="color: rgb(255, 255, 0); ">tabindex=</span><span style="color: rgb(187, 187, 0); ">&quot;5&quot;</span> <span style="color: rgb(255, 255, 0); ">value=</span><span style="color: rgb(187, 187, 0); ">&quot;Submit Comment&quot;</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">/&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;input</span> <span style="color: rgb(255, 255, 0); ">type=</span><span style="color: rgb(187, 187, 0); ">&quot;hidden&quot;</span> <span style="color: rgb(255, 255, 0); ">name=</span><span style="color: rgb(187, 187, 0); ">&quot;comment_post_ID&quot;</span> <span style="color: rgb(255, 255, 0); ">value=</span><span style="color: rgb(187, 187, 0); ">&quot;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(204, 204, 0); ">$id</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(187, 187, 0); ">&quot;</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">/&gt;&lt;/p&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(192, 192, 192); ">do_action</span>(<span style="color: rgb(187, 187, 0); ">&#39;comment_form&#39;</span><span style="color: rgb(192, 192, 192); ">,</span> <span style="color: rgb(204, 204, 0); ">$post</span><span style="color: rgb(192, 192, 192); ">-&gt;</span><span style="color: rgb(255, 255, 0); ">ID</span>); <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/form&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">else</span> <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;p&gt;</span><span style="color: rgb(192, 192, 192); ">The comments are closed.</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/p&gt;</span>&nbsp; <br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endif</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span></div>
<p>  这是WordPress 用来请求评论的函数。</p>
<p>整个流程就是这样，现在你拥有了自己的 comments.php 文件了，通过简单的修饰，你可以得到如下所示的效果：</p>
<p><a href="http://fvf.me/img/comment/1.jpg"><img title="comment1" alt="comment1" src="http://fvf.me/img/comment/1.jpg" /></a></p>
<h4 id="little-tricks">5. 一些小技巧</h4>
<p>毫无疑问，仅仅是一张 comments.php 文件，你就可以对它进行各种各样的改进，这里我列出一个表，希望能帮到你。</p>
<h5 id="gravatars">1. Gravatars</h5>
<p>从Wordpress2.5开始，Wordpress内置了对Gravatars头像的支持，这样Wordpress就可以方便的通过博客用户的邮箱地址来显示相关联头像。要实现这个效果的代码非常简单。</p>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(192, 192, 192); ">get_avatar</span>(<span style="color: rgb(204, 204, 0); ">$author_email</span><span style="color: rgb(192, 192, 192); ">,</span> <span style="color: rgb(204, 204, 0); ">$size</span><span style="color: rgb(192, 192, 192); ">,</span> <span style="color: rgb(204, 204, 0); ">$default_avatar</span> ); <span style="color: rgb(255, 255, 255); ">?&gt;</span></div>
<p>在上述代码中，你可以把 $author_email 更换为 get_comment_author_email(); 函数，$size 则是头像的宽高，至于 $default_avatar 参数则是用来调用默认的头像，而且这个只在用户没有Gravatars头像时生效。</p>
<p>把上述代码插入评论的 foreach 循环。这样就可以输出 Gravatars 头像，该头像还有特定的评级以及大小（这完全取决于博客的设置），结合简单的CSS，你可以轻易的得到如下效果：</p>
<p><a href="http://fvf.me/img/comment/2.jpg"><img title="comment2" alt="comment2" src="http://fvf.me/img/comment/2.jpg" /></a></p>
<h5 id="comment-numbers">2. 评论数</h5>
<p>我特意把comments.php文件头部代码留在我们建立页面以后，因为我相信多余的代码会使学习过程变成复杂。当然了，我是不会忘记使用他们的。</p>
<p>通常，人们会看到一个类似于“迄今已经有3评论”，这要感谢wordpress提供了这么简单的模板标签。</p>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(192, 192, 192); ">comments_number</span>(<span style="color: rgb(204, 204, 0); ">$zero_comments</span><span style="color: rgb(192, 192, 192); ">,</span> <span style="color: rgb(204, 204, 0); ">$one_comment</span><span style="color: rgb(192, 192, 192); ">,</span> <span style="color: rgb(204, 204, 0); ">$more_comments</span>); <span style="color: rgb(255, 255, 255); ">?&gt;</span></div>
<p>不用说都明白：在显示的文本时$ zero_comments是，没有人发表评论， $ one_comment时有一个评论和$ more_comments当有多个评论。举个例子如下：</p>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(192, 192, 192); ">comments_number</span>(<span style="color: rgb(187, 187, 0); ">&#39;No comments&#39;</span><span style="color: rgb(192, 192, 192); ">,</span> <span style="color: rgb(187, 187, 0); ">&#39;One comment&#39;</span><span style="color: rgb(192, 192, 192); ">,</span> <span style="color: rgb(187, 187, 0); ">&#39;% comments&#39;</span>); <span style="color: rgb(255, 255, 255); ">?&gt;</span></div>
<p>我用％表示多少评论，因为comments_number功能能把%替换成（ 2 ， 3 ， ... ）</p>
<p>使用我们的comments.php文件，你可以轻易的得到如下效果：</p>
<p><a href="http://fvf.me/img/comment/3.jpg"><img title="comment3" alt="comment3" src="http://fvf.me/img/comment/3.jpg" /></a></p>
<h5 id="comment-links">3. 评论链接</h5>
<p>要显示一个链接的评论部分（或若干评论显示） ，只需使用以下代码</p>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(192, 192, 192); ">comments_popup_link</span>(<span style="color: rgb(204, 204, 0); ">$zero_comments</span><span style="color: rgb(192, 192, 192); ">,</span> <span style="color: rgb(204, 204, 0); ">$one_comment</span><span style="color: rgb(192, 192, 192); ">,</span> <span style="color: rgb(204, 204, 0); ">$more_comments</span><span style="color: rgb(192, 192, 192); ">,</span> <span style="color: rgb(204, 204, 0); ">$css_class</span><span style="color: rgb(192, 192, 192); ">,</span> <span style="color: rgb(204, 204, 0); ">$comments_closed</span>); <span style="color: rgb(255, 255, 255); ">?&gt;</span></div>
<p>前3个参数，功能同上述comments_number功能一样。 $ css_class，很显然这个标记CSS类，给链接&lt;a&gt;标记，$comments_closed是表示当时的评论已经关闭。</p>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(192, 192, 192); ">comments_popup_link</span>(<span style="color: rgb(187, 187, 0); ">&#39;No comments&#39;</span><span style="color: rgb(192, 192, 192); ">,</span> <span style="color: rgb(187, 187, 0); ">&#39;One comment&#39;</span><span style="color: rgb(192, 192, 192); ">,</span> <span style="color: rgb(187, 187, 0); ">&#39;% comments&#39;</span><span style="color: rgb(192, 192, 192); ">,</span> <span style="color: rgb(187, 187, 0); ">&#39;comments-link&#39;</span><span style="color: rgb(192, 192, 192); ">,</span> <span style="color: rgb(187, 187, 0); ">&#39;Comments are closed&#39;</span>); <span style="color: rgb(255, 255, 255); ">?&gt;</span></div>
<p>这就给你的链接加上了名为comments-link的class</p>
<h5 id="editing-comments">4. 编辑评论</h5>
<p>有时你会想到立即修改评论。幸运的是，运用edit_comment_link功能，您可以轻松地在网页中进行编辑，而不需要进到您的管理后台，以最终达成评论的目的。用法是这样的：</p>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(192, 192, 192); ">edit_comment_link</span>(<span style="color: rgb(204, 204, 0); ">$link_text</span><span style="color: rgb(192, 192, 192); ">,</span> <span style="color: rgb(204, 204, 0); ">$before_link</span><span style="color: rgb(192, 192, 192); ">,</span> <span style="color: rgb(204, 204, 0); ">$after_link</span>); <span style="color: rgb(255, 255, 255); ">?&gt;</span></div>
<p>你必须把这个代码放到foreach循环里面。参数是显而易见的： $ link_text是修改链接的锚文本， $ before_link和$ after_link分别是显示在之前或之后链接的文字或代码。</p>
<p>这样确实更容易修改评论，您可以只需添加一个小'编辑'链接到您的评论中（只能先以管理员的身份登录后） 。这就是它可以如下所示：</p>
<p><a href="http://fvf.me/img/comment/4.jpg"><img title="comment4" alt="comment4" src="http://fvf.me/img/comment/4.jpg" /></a></p>
<h5 id="alternate-rows">5. 评论的交互颜色</h5>
<p>可能您想要的您的评论交替行颜色变换，以达到更准确的分辨。这里有一种简单的方法。首先，将以下代码添加到网页顶部的：</p>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(255, 255, 0); font-weight: bold; ">function</span> <span style="color: rgb(192, 192, 192); ">alternate_rows</span>(<span style="color: rgb(192, 192, 192); ">$i</span><span style="color: rgb(192, 192, 192); ">){</span><span style="color: rgb(192, 192, 192); ">&lt;</span><span style="color: rgb(192, 192, 192); ">br</span> <span style="color: rgb(192, 192, 192); ">/&gt;</span>&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>(<span style="color: rgb(192, 192, 192); ">$i</span> <span style="color: rgb(192, 192, 192); ">%</span> <span style="color: rgb(192, 192, 192); ">2</span>) <span style="color: rgb(192, 192, 192); ">{</span><span style="color: rgb(192, 192, 192); ">&lt;</span><span style="color: rgb(192, 192, 192); ">br</span> <span style="color: rgb(192, 192, 192); ">/&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(192, 192, 192); ">echo</span> <span style="color: rgb(187, 187, 0); ">&#39; class=&quot;alt&quot;&#39;</span>;<span style="color: rgb(192, 192, 192); ">&lt;</span><span style="color: rgb(192, 192, 192); ">br</span> <span style="color: rgb(192, 192, 192); ">/&gt;</span>&nbsp;&nbsp;&nbsp; <span style="color: rgb(192, 192, 192); ">}</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">else</span> <span style="color: rgb(192, 192, 192); ">{</span><span style="color: rgb(192, 192, 192); ">&lt;</span><span style="color: rgb(192, 192, 192); ">br</span> <span style="color: rgb(192, 192, 192); ">/&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(192, 192, 192); ">echo</span> <span style="color: rgb(187, 187, 0); ">&#39;&#39;</span>;<span style="color: rgb(192, 192, 192); ">&lt;</span><span style="color: rgb(192, 192, 192); ">br</span> <span style="color: rgb(192, 192, 192); ">/&gt;</span>&nbsp;&nbsp;&nbsp; <span style="color: rgb(192, 192, 192); ">}</span>&nbsp; <br /> <span style="color: rgb(192, 192, 192); ">}</span></div>
<p>然后添加以下到foreach循环内 。你可以查找&lt;li id="comment-&lt;?php comment_ID(); ?&gt;"&gt; ，然后用一下代码替换：</p>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(204, 204, 0); ">$i</span><span style="color: rgb(192, 192, 192); ">++</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span>&nbsp; <br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;li</span> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(192, 192, 192); ">alternate_rows</span>(<span style="color: rgb(204, 204, 0); ">$i</span>); <span style="color: rgb(255, 255, 255); ">?&gt;</span> <span style="color: rgb(255, 255, 0); ">id=</span><span style="color: rgb(187, 187, 0); ">&quot;comment-</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(192, 192, 192); ">comment_ID</span>(); <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(187, 187, 0); ">&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;</span>&nbsp; <br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/li&gt;</span></div>
<p>这将使评论出现两个不同的class ，从而可以通过CSS改变其外观 。<br />
我决定把它制成function，以减少对您实际主题文件的影响。您可以将它添加到您的函数定义functions.php文件里，但更有意义，对我来说，只是把它放到网页上面。<br />
交行更容易区分不同评论；一旦实施，您可能需要像这样：</p>
<p><a href="http://fvf.me/img/comment/5.jpg"><img title="comment5" alt="comment5" src="http://fvf.me/img/comment/5.jpg" /></a></p>
<h5 id="allowed-tags">6. 显示标签</h5>
<p>显示访问者可以在他们的意见使用的标签，只需使用以下的一段片段</p>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(192, 192, 192); ">Allowed tags: </span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(192, 192, 192); ">allowed_tags</span>(); <span style="color: rgb(255, 255, 255); ">?&gt;</span></div>
<p>那么你一定会得到一个的名单，写着您可以在评论使用的标签，例如：</p>
<p><a href="http://fvf.me/img/comment/6.jpg"><img title="comment6" alt="comment6" src="http://fvf.me/img/comment/6.jpg" /></a></p>
<h5 id="comment-rss">7. 评论的RSS链接</h5>
<p>要获得链接RSS评论的地址，只需将下面的代码插入到您的comments.php文件中您想要的地方。</p>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(192, 192, 192); ">comments_rss_link</span>(<span style="color: rgb(204, 204, 0); ">$link_text</span>); <span style="color: rgb(255, 255, 255); ">?&gt;</span></div>
<p>然后只需更换$ link_test为RSS链接的锚文本。</p>
<p>如果您想给您的访客有机会为某一特定的文章或博客帖子订阅评论的话，那这代码会派上用场。您可以得到以下效果：</p>
<p><a href="http://fvf.me/img/comment/7.jpg"><img title="comment7" alt="comment7" src="http://fvf.me/img/comment/7.jpg" /></a></p>
<h4 id="conclusion">6. 总结</h4>
<p>我希望你也很喜欢这个关于WordPress的comments.php文件的文章。你可以使用这里的全部代码，我的技巧包括在它表明：</p>
<p>gravatars ，</p>
<p>候补行的颜色，</p>
<p>编辑链接，</p>
<p>评论RSS链接。</p>
<p>显然，评论链接，因为这不包括已被用来内部循环 。</p>
<p>祝您在你的WordPress皮肤制作上有好运！</p>
<p>终于翻译完了！</p>
]]></content:encoded>
			<wfw:commentRss>http://fvf.me/translate/detailed-comment-php-production-template.html/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>给主题增加滑动效果(gotoup)</title>
		<link>http://fvf.me/wordpress/tips/to-increase-the-sliding-effect-of-the-theme-gotoup.html</link>
		<comments>http://fvf.me/wordpress/tips/to-increase-the-sliding-effect-of-the-theme-gotoup.html#comments</comments>
		<pubDate>Wed, 05 Aug 2009 10:50:09 +0000</pubDate>
		<dc:creator>死兔子</dc:creator>
				<category><![CDATA[小技巧]]></category>
		<category><![CDATA[down]]></category>
		<category><![CDATA[top]]></category>
		<category><![CDATA[主题]]></category>
		<category><![CDATA[滑动]]></category>

		<guid isPermaLink="false">http://fvf.me/wordpress/%e7%bb%99%e4%b8%bb%e9%a2%98%e5%a2%9e%e5%8a%a0%e6%bb%91%e5%8a%a8%e6%95%88%e6%9e%9cgotoup.html</guid>
		<description><![CDATA[今天把导航栏固定了，想起增加滑动效果使之能够滚动到网页上部或下部。嘿嘿！不过在Google那搜索了一下。找了很久还是没找到，后来偶然的情况下发现了 xiaorsz写的文章，不过太复杂了，然后转到了popdo那里。发现这个方法简单！就用了这个方法！我是在footer.php最底下加入这个代码 &#60;script type=&#34;text/javascript&#34; src=&#34;http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js&#34;&#62;&#60;/script&#62; &#60;script type=&#34;text/javascript&#34;&#62; $(document).ready(function(){ &#160; $(&#39;a[href*=#]&#39;).click(function() { &#160;&#160;&#160; if (location.pathname.replace(/^\//,&#39;&#39;) == this.pathname.replace(/^\//,&#39;&#39;) &#160;&#160;&#160; &#38;&#38; location.hostname == this.hostname) { &#160;&#160;&#160;&#160;&#160; var $target = $(this.hash); &#160;&#160;&#160;&#160;&#160; $target = $target.length &#38;&#38; $target &#160;&#160;&#160;&#160;&#160; &#124;&#124; $(&#39;[name=&#39; + this.hash.slice(1) +&#39;]&#39;); &#160;&#160;&#160;&#160;&#160; if ($target.length) { &#160;&#160;&#160;&#160;&#160;&#160;&#160; var targetOffset = $target.offset().top; &#160;&#160;&#160;&#160;&#160;&#160;&#160; $(&#39;html,body&#39;) &#160;&#160;&#160;&#160;&#160;&#160;&#160; .animate({scrollTop: targetOffset}, 1000); &#160;&#160;&#160;&#160;&#160;&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>今天把导航栏固定了，想起增加滑动效果使之能够滚动到网页上部或下部。嘿嘿！不过在Google那搜索了一下。找了很久还是没找到，后来偶然的情况下发现了 xiaorsz写的文章，不过太复杂了，然后转到了popdo那里。发现这个方法简单！就用了这个方法！我是在footer.php最底下加入这个代码</p>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(192, 192, 192); ">&lt;</span><span style="color: rgb(192, 192, 192); ">script</span> <span style="color: rgb(192, 192, 192); ">type</span><span style="color: rgb(192, 192, 192); ">=</span><span style="color: rgb(187, 187, 0); ">&quot;text/javascript&quot;</span> <span style="color: rgb(192, 192, 192); ">src</span><span style="color: rgb(192, 192, 192); ">=</span><span style="color: rgb(187, 187, 0); ">&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js&quot;</span><span style="color: rgb(192, 192, 192); ">&gt;&lt;</span><span style="color: rgb(192, 192, 192); ">/script&gt;</span><br /> <span style="color: rgb(192, 192, 192); ">&lt;</span><span style="color: rgb(192, 192, 192); ">script</span> <span style="color: rgb(192, 192, 192); ">type</span><span style="color: rgb(192, 192, 192); ">=</span><span style="color: rgb(187, 187, 0); ">&quot;text/javascript&quot;</span><span style="color: rgb(192, 192, 192); ">&gt;</span><br /> <span style="color: rgb(192, 192, 192); ">$</span>(<span style="color: rgb(192, 192, 192); ">document</span><span style="color: rgb(192, 192, 192); ">).</span><span style="color: rgb(192, 192, 192); ">ready</span>(<span style="color: rgb(255, 255, 0); font-weight: bold; ">function</span><span style="color: rgb(192, 192, 192); ">(){</span><br /> &nbsp; <span style="color: rgb(192, 192, 192); ">$</span>(<span style="color: rgb(187, 187, 0); ">&#39;a[href*=#]&#39;</span><span style="color: rgb(192, 192, 192); ">).</span><span style="color: rgb(192, 192, 192); ">click</span>(<span style="color: rgb(255, 255, 0); font-weight: bold; ">function</span>() <span style="color: rgb(192, 192, 192); ">{</span><br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span> (<span style="color: rgb(192, 192, 192); ">location</span><span style="color: rgb(192, 192, 192); ">.</span><span style="color: rgb(192, 192, 192); ">pathname</span><span style="color: rgb(192, 192, 192); ">.</span><span style="color: rgb(192, 192, 192); ">replace</span>(<span style="color: rgb(187, 187, 0); ">/^\//</span><span style="color: rgb(192, 192, 192); ">,</span><span style="color: rgb(187, 187, 0); ">&#39;&#39;</span>) <span style="color: rgb(192, 192, 192); ">==</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">this</span><span style="color: rgb(192, 192, 192); ">.</span><span style="color: rgb(192, 192, 192); ">pathname</span><span style="color: rgb(192, 192, 192); ">.</span><span style="color: rgb(192, 192, 192); ">replace</span>(<span style="color: rgb(187, 187, 0); ">/^\//</span><span style="color: rgb(192, 192, 192); ">,</span><span style="color: rgb(187, 187, 0); ">&#39;&#39;</span>)<br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(192, 192, 192); ">&amp;&amp;</span> <span style="color: rgb(192, 192, 192); ">location</span><span style="color: rgb(192, 192, 192); ">.</span><span style="color: rgb(192, 192, 192); ">hostname</span> <span style="color: rgb(192, 192, 192); ">==</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">this</span><span style="color: rgb(192, 192, 192); ">.</span><span style="color: rgb(192, 192, 192); ">hostname</span>) <span style="color: rgb(192, 192, 192); ">{</span><br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">var</span> <span style="color: rgb(192, 192, 192); ">$target</span> <span style="color: rgb(192, 192, 192); ">=</span> <span style="color: rgb(192, 192, 192); ">$</span>(<span style="color: rgb(255, 255, 0); font-weight: bold; ">this</span><span style="color: rgb(192, 192, 192); ">.</span><span style="color: rgb(192, 192, 192); ">hash</span>);<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(192, 192, 192); ">$target</span> <span style="color: rgb(192, 192, 192); ">=</span> <span style="color: rgb(192, 192, 192); ">$target</span><span style="color: rgb(192, 192, 192); ">.</span><span style="color: rgb(192, 192, 192); ">length</span> <span style="color: rgb(192, 192, 192); ">&amp;&amp;</span> <span style="color: rgb(192, 192, 192); ">$target</span> <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; || <span style="color: rgb(192, 192, 192); ">$</span>(<span style="color: rgb(187, 187, 0); ">&#39;[name=&#39;</span> <span style="color: rgb(192, 192, 192); ">+</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">this</span><span style="color: rgb(192, 192, 192); ">.</span><span style="color: rgb(192, 192, 192); ">hash</span><span style="color: rgb(192, 192, 192); ">.</span><span style="color: rgb(192, 192, 192); ">slice</span>(<span style="color: rgb(192, 192, 192); ">1</span>) <span style="color: rgb(192, 192, 192); ">+</span><span style="color: rgb(187, 187, 0); ">&#39;]&#39;</span>);<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span> (<span style="color: rgb(192, 192, 192); ">$target</span><span style="color: rgb(192, 192, 192); ">.</span><span style="color: rgb(192, 192, 192); ">length</span>) <span style="color: rgb(192, 192, 192); ">{</span><br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">var</span> <span style="color: rgb(192, 192, 192); ">targetOffset</span> <span style="color: rgb(192, 192, 192); ">=</span> <span style="color: rgb(192, 192, 192); ">$target</span><span style="color: rgb(192, 192, 192); ">.</span><span style="color: rgb(192, 192, 192); ">offset</span><span style="color: rgb(192, 192, 192); ">().</span><span style="color: rgb(192, 192, 192); ">top</span>;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(192, 192, 192); ">$</span>(<span style="color: rgb(187, 187, 0); ">&#39;html,body&#39;</span>)<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(192, 192, 192); ">.</span><span style="color: rgb(192, 192, 192); ">animate</span><span style="color: rgb(192, 192, 192); ">({</span><span style="color: rgb(192, 192, 192); ">scrollTop</span><span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(192, 192, 192); ">targetOffset</span><span style="color: rgb(192, 192, 192); ">},</span> <span style="color: rgb(192, 192, 192); ">1000</span>);<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 255, 0); font-weight: bold; ">return</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">false</span>;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(192, 192, 192); ">}</span><br /> &nbsp;&nbsp;&nbsp; <span style="color: rgb(192, 192, 192); ">}</span><br /> &nbsp; <span style="color: rgb(192, 192, 192); ">});</span></p>
<p> <span style="color: rgb(192, 192, 192); ">});</span><br /> <span style="color: rgb(192, 192, 192); ">&lt;</span><span style="color: rgb(192, 192, 192); ">/script&gt;</span></div>
<p>在页面需要的地方中加入以下代码：(链接方式为#加ID名称)</p>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;div</span> <span style="color: rgb(255, 255, 0); ">id=</span><span style="color: rgb(187, 187, 0); ">&quot;gotop&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;&lt;a</span> <span style="color: rgb(255, 255, 0); ">href=</span><span style="color: rgb(187, 187, 0); ">&quot;#header&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;</span><span style="color: rgb(192, 192, 192); ">Top</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/a&gt;&lt;/div&gt;</span><br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;div</span> <span style="color: rgb(255, 255, 0); ">id=</span><span style="color: rgb(187, 187, 0); ">&quot;godown&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;&lt;a</span> <span style="color: rgb(255, 255, 0); ">href=</span><span style="color: rgb(187, 187, 0); ">&quot;#footer&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;</span><span style="color: rgb(192, 192, 192); ">Down</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/a&gt;&lt;/div&gt;</span></div>
<p>这个代码可以实现留言转向！</p>
<p>接下来就是css了自己写吧，我就不说明了！</p>
<p>当然了还有留言也此有效果,不过在Opera上向上的没有滚动效果，不过还是能够链接过去.</p>
]]></content:encoded>
			<wfw:commentRss>http://fvf.me/wordpress/tips/to-increase-the-sliding-effect-of-the-theme-gotoup.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>相关文章代码-wordpress主题</title>
		<link>http://fvf.me/wordpress/theme/related-articles-code-wordpress-theme.html</link>
		<comments>http://fvf.me/wordpress/theme/related-articles-code-wordpress-theme.html#comments</comments>
		<pubDate>Wed, 05 Aug 2009 08:39:58 +0000</pubDate>
		<dc:creator>死兔子</dc:creator>
				<category><![CDATA[主题]]></category>
		<category><![CDATA[代码]]></category>
		<category><![CDATA[相关文章]]></category>

		<guid isPermaLink="false">http://fvf.me/wordpress/%e7%9b%b8%e5%85%b3%e6%96%87%e7%ab%a0%e4%bb%a3%e7%a0%81-wordpress%e4%b8%bb%e9%a2%98.html</guid>
		<description><![CDATA[相关的10篇文章]]></description>
			<content:encoded><![CDATA[<p>相关的10篇文章</p>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;ul&gt;</span> <br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <br /> <span style="color: rgb(204, 204, 0); ">$tags</span> <span style="color: rgb(192, 192, 192); ">=</span> <span style="color: rgb(192, 192, 192); ">wp_get_post_tags</span>(<span style="color: rgb(204, 204, 0); ">$post</span><span style="color: rgb(192, 192, 192); ">-&gt;</span><span style="color: rgb(255, 255, 0); ">ID</span>); <br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span> (<span style="color: rgb(204, 204, 0); ">$tags</span>) <span style="color: rgb(192, 192, 192); ">{</span> <br /> <span style="color: rgb(204, 204, 0); ">$first_tag</span> <span style="color: rgb(192, 192, 192); ">=</span> <span style="color: rgb(204, 204, 0); ">$tags</span><span style="color: rgb(192, 192, 192); ">[</span><span style="color: rgb(192, 192, 192); ">0</span><span style="color: rgb(192, 192, 192); ">]</span><span style="color: rgb(192, 192, 192); ">-&gt;</span><span style="color: rgb(255, 255, 0); ">term_id</span>; <br /> <span style="color: rgb(204, 204, 0); ">$args</span><span style="color: rgb(192, 192, 192); ">=</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">array</span>( <br /> <span style="color: rgb(187, 187, 0); ">&#39;tag__in&#39;</span> <span style="color: rgb(192, 192, 192); ">=&gt;</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">array</span>(<span style="color: rgb(204, 204, 0); ">$first_tag</span><span style="color: rgb(192, 192, 192); ">),</span> <br /> <span style="color: rgb(187, 187, 0); ">&#39;post__not_in&#39;</span> <span style="color: rgb(192, 192, 192); ">=&gt;</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">array</span>(<span style="color: rgb(204, 204, 0); ">$post</span><span style="color: rgb(192, 192, 192); ">-&gt;</span><span style="color: rgb(255, 255, 0); ">ID</span><span style="color: rgb(192, 192, 192); ">),</span> <br /> <span style="color: rgb(187, 187, 0); ">&#39;showposts&#39;</span><span style="color: rgb(192, 192, 192); ">=&gt;</span><span style="color: rgb(192, 192, 192); ">10</span><span style="color: rgb(192, 192, 192); ">,</span> <br /> <span style="color: rgb(187, 187, 0); ">&#39;caller_get_posts&#39;</span><span style="color: rgb(192, 192, 192); ">=&gt;</span><span style="color: rgb(192, 192, 192); ">1</span> <br /> ); <br /> <span style="color: rgb(204, 204, 0); ">$my_query</span> <span style="color: rgb(192, 192, 192); ">=</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">new</span> <span style="color: rgb(192, 192, 192); ">WP_Query</span>(<span style="color: rgb(204, 204, 0); ">$args</span>); <br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span>( <span style="color: rgb(204, 204, 0); ">$my_query</span><span style="color: rgb(192, 192, 192); ">-&gt;</span><span style="color: rgb(255, 255, 0); ">have_posts</span>() ) <span style="color: rgb(192, 192, 192); ">{</span> <br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">while</span> (<span style="color: rgb(204, 204, 0); ">$my_query</span><span style="color: rgb(192, 192, 192); ">-&gt;</span><span style="color: rgb(255, 255, 0); ">have_posts</span>()) <span style="color: rgb(192, 192, 192); ">:</span> <span style="color: rgb(204, 204, 0); ">$my_query</span><span style="color: rgb(192, 192, 192); ">-&gt;</span><span style="color: rgb(255, 255, 0); ">the_post</span>(); <span style="color: rgb(255, 255, 255); ">?&gt;</span> <br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;li&gt;&lt;a</span> <span style="color: rgb(255, 255, 0); ">href=</span><span style="color: rgb(187, 187, 0); ">&quot;&amp;lt;?php the_permalink() ?&amp;gt;&quot;</span> <span style="color: rgb(255, 255, 0); ">rel=</span><span style="color: rgb(187, 187, 0); ">&quot;bookmark&quot;</span> <span style="color: rgb(255, 255, 0); ">title=</span><span style="color: rgb(187, 187, 0); ">&quot;Permanent Link to </span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(192, 192, 192); ">the_title_attribute</span>(); <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(187, 187, 0); ">&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(192, 192, 192); ">the_title</span>(); <span style="color: rgb(255, 255, 255); ">?&gt;</span> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(192, 192, 192); ">comments_number</span>(<span style="color: rgb(187, 187, 0); ">&#39; &#39;</span><span style="color: rgb(192, 192, 192); ">,</span><span style="color: rgb(187, 187, 0); ">&#39;(1)&#39;</span><span style="color: rgb(192, 192, 192); ">,</span><span style="color: rgb(187, 187, 0); ">&#39;(%)&#39;</span>); <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/a&gt;</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/li&gt;</span> <br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endwhile</span>; <br /> <span style="color: rgb(192, 192, 192); ">}</span> <br /> <span style="color: rgb(192, 192, 192); ">}</span> <br /> <span style="color: rgb(255, 255, 255); ">?&gt;</span> <br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/ul&gt;</span></div>
<p>特注明此代码适用于侧边栏，如使用在single页文章一下的话，建议使用WordPress Related Posts插件！因为此代码会一起评论页标题的错误！</p>
]]></content:encoded>
			<wfw:commentRss>http://fvf.me/wordpress/theme/related-articles-code-wordpress-theme.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>随机文章代码-wordpress主题</title>
		<link>http://fvf.me/wordpress/theme/random-article-code-wordpress-theme.html</link>
		<comments>http://fvf.me/wordpress/theme/random-article-code-wordpress-theme.html#comments</comments>
		<pubDate>Wed, 05 Aug 2009 08:37:39 +0000</pubDate>
		<dc:creator>死兔子</dc:creator>
				<category><![CDATA[主题]]></category>
		<category><![CDATA[代码]]></category>
		<category><![CDATA[随机文章]]></category>

		<guid isPermaLink="false">http://fvf.me/wordpress/%e9%9a%8f%e6%9c%ba%e6%96%87%e7%ab%a0%e4%bb%a3%e7%a0%81-wordpress%e4%b8%bb%e9%a2%98.html</guid>
		<description><![CDATA[随机的10篇文章]]></description>
			<content:encoded><![CDATA[<p>随机的10篇文章</p>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(255, 255, 255); ">&lt;?php</span><br /> <span style="color: rgb(204, 204, 0); ">$rand_posts</span> <span style="color: rgb(192, 192, 192); ">=</span> <span style="color: rgb(192, 192, 192); ">get_posts</span>(<span style="color: rgb(187, 187, 0); ">&#39;numberposts=10&amp;orderby=rand&#39;</span>);<br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">foreach</span>( <span style="color: rgb(204, 204, 0); ">$rand_posts</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">as</span> <span style="color: rgb(204, 204, 0); ">$post</span> ) <span style="color: rgb(192, 192, 192); ">:</span><br /> <span style="color: rgb(255, 255, 255); ">?&gt;</span><br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;li&gt;&lt;a</span> <span style="color: rgb(255, 255, 0); ">href=</span><span style="color: rgb(187, 187, 0); ">&quot;&amp;lt;?php the_permalink(); ?&amp;gt;&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;</span><br /> <span style="color: rgb(192, 192, 192); ">&lt;</span><span style="color: rgb(192, 192, 192); "> ?php the_title(); ?&gt;</span><br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/a&gt;&lt;/li&gt;</span><br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">endforeach</span>; <span style="color: rgb(255, 255, 255); ">?&gt;</span></div>
<p>特注明此代码适用于侧边栏，如使用在single页文章一下的话，建议使用WordPress 中文工具箱插件！因为此代码会一起评论页标题的错误！</p>
]]></content:encoded>
			<wfw:commentRss>http://fvf.me/wordpress/theme/random-article-code-wordpress-theme.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>最新评论代码-wordpress主题</title>
		<link>http://fvf.me/wordpress/theme/the-latest-comments-code-wordpress-theme-2.html</link>
		<comments>http://fvf.me/wordpress/theme/the-latest-comments-code-wordpress-theme-2.html#comments</comments>
		<pubDate>Wed, 05 Aug 2009 08:34:51 +0000</pubDate>
		<dc:creator>死兔子</dc:creator>
				<category><![CDATA[主题]]></category>
		<category><![CDATA[代码]]></category>
		<category><![CDATA[最新评论]]></category>

		<guid isPermaLink="false">http://fvf.me/wordpress/%e6%9c%80%e6%96%b0%e8%af%84%e8%ae%ba%e4%bb%a3%e7%a0%81-wordpress%e4%b8%bb%e9%a2%98.html</guid>
		<description><![CDATA[最新的10篇评论]]></description>
			<content:encoded><![CDATA[<p>最新的10篇评论</p>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">global</span> <span style="color: rgb(204, 204, 0); ">$wpdb</span>; <br /> <span style="color: rgb(204, 204, 0); ">$sql</span> <span style="color: rgb(192, 192, 192); ">=</span> <span style="color: rgb(187, 187, 0); ">&quot;SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved, comment_type,comment_author_url, SUBSTRING(comment_content,1,30) AS com_excerpt FROM </span><span style="color: rgb(187, 187, 0); ">$wpdb-&gt;comments</span><span style="color: rgb(187, 187, 0); "> LEFT OUTER JOIN </span><span style="color: rgb(187, 187, 0); ">$wpdb-&gt;posts</span><span style="color: rgb(187, 187, 0); "> ON (</span><span style="color: rgb(187, 187, 0); ">$wpdb-&gt;comments</span><span style="color: rgb(187, 187, 0); ">.comment_post_ID = </span><span style="color: rgb(187, 187, 0); ">$wpdb-&gt;posts</span><span style="color: rgb(187, 187, 0); ">.ID) WHERE comment_approved = &#39;1&#39; AND comment_type = &quot;</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">AND</span> <span style="color: rgb(192, 192, 192); ">post_password</span> <span style="color: rgb(192, 192, 192); ">=</span> <span style="color: rgb(187, 187, 0); ">&quot; ORDER BY comment_date_gmt DESC LIMIT 10&quot;</span>; </p>
<p> <span style="color: rgb(204, 204, 0); ">$comments</span> <span style="color: rgb(192, 192, 192); ">=</span> <span style="color: rgb(204, 204, 0); ">$wpdb</span><span style="color: rgb(192, 192, 192); ">-&gt;</span><span style="color: rgb(255, 255, 0); ">get_results</span>(<span style="color: rgb(204, 204, 0); ">$sql</span>); <br /> <span style="color: rgb(204, 204, 0); ">$output</span> <span style="color: rgb(192, 192, 192); ">=</span> <span style="color: rgb(204, 204, 0); ">$pre_HTML</span>; </p>
<p> <span style="color: rgb(255, 255, 0); font-weight: bold; ">foreach</span> (<span style="color: rgb(204, 204, 0); ">$comments</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">as</span> <span style="color: rgb(204, 204, 0); ">$comment</span>) <span style="color: rgb(192, 192, 192); ">{</span> <br /> <span style="color: rgb(204, 204, 0); ">$output</span> <span style="color: rgb(192, 192, 192); ">.=</span> <span style="color: rgb(187, 187, 0); ">&quot;</span><span style="color: rgb(187, 187, 0); ">\n</span><span style="color: rgb(187, 187, 0); ">&lt;li&gt;&quot;</span><span style="color: rgb(192, 192, 192); ">.</span> <span style="color: rgb(187, 187, 0); ">&quot;&lt;a href=&quot;</span><span style="color: rgb(192, 192, 192); ">\</span><span style="color: rgb(192, 192, 192); ">&amp;</span><span style="color: rgb(192, 192, 192); ">quot</span>;<span style="color: rgb(192, 192, 192); ">&amp;</span><span style="color: rgb(192, 192, 192); ">quot</span>;<span style="color: rgb(187, 187, 0); ">&quot; . get_permalink(</span><span style="color: rgb(187, 187, 0); ">$comment-&gt;ID</span><span style="color: rgb(187, 187, 0); ">).&quot;</span><span style="color: rgb(105, 105, 105); ">#comment-&quot; . $comment-&gt;comment_ID . &quot;\" title=\"on ".$comment-&gt;post_title . "\"&gt;".strip_tags($comment-&gt;comment_author)."&lt;/a&gt;" .": " .strip_tags($comment-&gt;com_excerpt)."&lt;/li&gt;"; </span><br /> <span style="color: rgb(192, 192, 192); ">}</span> </p>
<p> <span style="color: rgb(204, 204, 0); ">$output</span> <span style="color: rgb(192, 192, 192); ">.=</span> <span style="color: rgb(204, 204, 0); ">$post_HTML</span>; <br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(204, 204, 0); ">$output</span>; <br /> <span style="color: rgb(255, 255, 255); ">?&gt;</span></div>
<p>特注明此代码适用于侧边栏，如使用在single页文章一下的话，建议使用WordPress中文工具箱插件！因为此代码会一起评论页标题的错误！</p>
]]></content:encoded>
			<wfw:commentRss>http://fvf.me/wordpress/theme/the-latest-comments-code-wordpress-theme-2.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>最热文章代码-wordpress主题</title>
		<link>http://fvf.me/wordpress/theme/article-hottest-code-wordpress-theme.html</link>
		<comments>http://fvf.me/wordpress/theme/article-hottest-code-wordpress-theme.html#comments</comments>
		<pubDate>Wed, 05 Aug 2009 08:31:16 +0000</pubDate>
		<dc:creator>死兔子</dc:creator>
				<category><![CDATA[主题]]></category>
		<category><![CDATA[代码]]></category>
		<category><![CDATA[最热文章]]></category>

		<guid isPermaLink="false">http://fvf.me/wordpress/%e6%9c%80%e7%83%ad%e6%96%87%e7%ab%a0%e4%bb%a3%e7%a0%81-wordpress%e4%b8%bb%e9%a2%98.html</guid>
		<description><![CDATA[留言数最多的10篇文章]]></description>
			<content:encoded><![CDATA[<p>留言数最多的10篇文章</p>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;ul</span> <span style="color: rgb(255, 255, 0); ">class=</span><span style="color: rgb(187, 187, 0); ">&quot;most_comments&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;</span> <br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(204, 204, 0); ">$result</span> <span style="color: rgb(192, 192, 192); ">=</span> <span style="color: rgb(204, 204, 0); ">$wpdb</span><span style="color: rgb(192, 192, 192); ">-&gt;</span><span style="color: rgb(255, 255, 0); ">get_results</span>(<span style="color: rgb(187, 187, 0); ">&quot;SELECT comment_count,ID,post_title FROM </span><span style="color: rgb(187, 187, 0); ">$wpdb-&gt;posts</span><span style="color: rgb(187, 187, 0); "> ORDER BY comment_count DESC LIMIT 0 , 10&quot;</span>); <br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">foreach</span> (<span style="color: rgb(204, 204, 0); ">$result</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">as</span> <span style="color: rgb(204, 204, 0); ">$post</span>) <span style="color: rgb(192, 192, 192); ">{</span> <br /> <span style="color: rgb(192, 192, 192); ">setup_postdata</span>(<span style="color: rgb(204, 204, 0); ">$post</span>); <br /> <span style="color: rgb(204, 204, 0); ">$postid</span> <span style="color: rgb(192, 192, 192); ">=</span> <span style="color: rgb(204, 204, 0); ">$post</span><span style="color: rgb(192, 192, 192); ">-&gt;</span><span style="color: rgb(255, 255, 0); ">ID</span>; <br /> <span style="color: rgb(204, 204, 0); ">$title</span> <span style="color: rgb(192, 192, 192); ">=</span> <span style="color: rgb(204, 204, 0); ">$post</span><span style="color: rgb(192, 192, 192); ">-&gt;</span><span style="color: rgb(255, 255, 0); ">post_title</span>; <br /> <span style="color: rgb(204, 204, 0); ">$commentcount</span> <span style="color: rgb(192, 192, 192); ">=</span> <span style="color: rgb(204, 204, 0); ">$post</span><span style="color: rgb(192, 192, 192); ">-&gt;</span><span style="color: rgb(255, 255, 0); ">comment_count</span>; <br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">if</span> (<span style="color: rgb(204, 204, 0); ">$commentcount</span> <span style="color: rgb(192, 192, 192); ">!=</span> <span style="color: rgb(192, 192, 192); ">0</span>) <span style="color: rgb(192, 192, 192); ">{</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span> <br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;li&gt;&lt;a</span> <span style="color: rgb(255, 255, 0); ">href=</span><span style="color: rgb(187, 187, 0); ">&quot;&amp;lt;?php echo get_permalink($postid); ?&amp;gt;&quot;</span> <span style="color: rgb(255, 255, 0); ">title=</span><span style="color: rgb(187, 187, 0); ">&quot;</span><span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(204, 204, 0); ">$title</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(187, 187, 0); ">&quot;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&gt;</span> <br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(204, 204, 0); ">$title</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span><span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/a&gt;</span> (<span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(204, 204, 0); ">$commentcount</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span>)<span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/li&gt;</span> <br /> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <span style="color: rgb(192, 192, 192); ">}</span> <span style="color: rgb(192, 192, 192); ">}</span> <span style="color: rgb(255, 255, 255); ">?&gt;</span> <br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">&lt;/ul&gt;</span></div>
<p>特注明此代码适用于侧边栏，如使用在single页文章一下的话，建议使用WordPress中文工具箱插件！因为此代码会一起评论页标题的错误！</p>
]]></content:encoded>
			<wfw:commentRss>http://fvf.me/wordpress/theme/article-hottest-code-wordpress-theme.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>最新文章代码-wordpress主题</title>
		<link>http://fvf.me/wordpress/theme/the-latest-post-co-wordpress-themede.html</link>
		<comments>http://fvf.me/wordpress/theme/the-latest-post-co-wordpress-themede.html#comments</comments>
		<pubDate>Wed, 05 Aug 2009 08:27:43 +0000</pubDate>
		<dc:creator>死兔子</dc:creator>
				<category><![CDATA[主题]]></category>
		<category><![CDATA[代码]]></category>
		<category><![CDATA[最新评论]]></category>

		<guid isPermaLink="false">http://fvf.me/wordpress/%e6%9c%80%e6%96%b0%e8%af%84%e8%ae%ba%e4%bb%a3%e7%a0%81-wordpress%e4%b8%bb%e9%a2%98.html</guid>
		<description><![CDATA[最新10篇文章]]></description>
			<content:encoded><![CDATA[<p>最新10篇文章</p>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(255, 255, 255); ">&lt;?php</span> <br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">global</span> <span style="color: rgb(204, 204, 0); ">$wpdb</span>; <br /> <span style="color: rgb(204, 204, 0); ">$sql</span> <span style="color: rgb(192, 192, 192); ">=</span> <span style="color: rgb(187, 187, 0); ">&quot;SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved, comment_type,comment_author_url, SUBSTRING(comment_content,1,30) AS com_excerpt FROM </span><span style="color: rgb(187, 187, 0); ">$wpdb-&gt;comments</span><span style="color: rgb(187, 187, 0); "> LEFT OUTER JOIN </span><span style="color: rgb(187, 187, 0); ">$wpdb-&gt;posts</span><span style="color: rgb(187, 187, 0); "> ON (</span><span style="color: rgb(187, 187, 0); ">$wpdb-&gt;comments</span><span style="color: rgb(187, 187, 0); ">.comment_post_ID = </span><span style="color: rgb(187, 187, 0); ">$wpdb-&gt;posts</span><span style="color: rgb(187, 187, 0); ">.ID) WHERE comment_approved = &#39;1&#39; AND comment_type = &quot;</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">AND</span> <span style="color: rgb(192, 192, 192); ">post_password</span> <span style="color: rgb(192, 192, 192); ">=</span> <span style="color: rgb(187, 187, 0); ">&quot; ORDER BY comment_date_gmt DESC LIMIT 10&quot;</span>; </p>
<p> <span style="color: rgb(204, 204, 0); ">$comments</span> <span style="color: rgb(192, 192, 192); ">=</span> <span style="color: rgb(204, 204, 0); ">$wpdb</span><span style="color: rgb(192, 192, 192); ">-&gt;</span><span style="color: rgb(255, 255, 0); ">get_results</span>(<span style="color: rgb(204, 204, 0); ">$sql</span>); <br /> <span style="color: rgb(204, 204, 0); ">$output</span> <span style="color: rgb(192, 192, 192); ">=</span> <span style="color: rgb(204, 204, 0); ">$pre_HTML</span>; </p>
<p> <span style="color: rgb(255, 255, 0); font-weight: bold; ">foreach</span> (<span style="color: rgb(204, 204, 0); ">$comments</span> <span style="color: rgb(255, 255, 0); font-weight: bold; ">as</span> <span style="color: rgb(204, 204, 0); ">$comment</span>) <span style="color: rgb(192, 192, 192); ">{</span> <br /> <span style="color: rgb(204, 204, 0); ">$output</span> <span style="color: rgb(192, 192, 192); ">.=</span> <span style="color: rgb(187, 187, 0); ">&quot;</span><span style="color: rgb(187, 187, 0); ">\n</span><span style="color: rgb(187, 187, 0); ">&lt;li&gt;&quot;</span><span style="color: rgb(192, 192, 192); ">.</span> <span style="color: rgb(187, 187, 0); ">&quot;&lt;a href=&quot;</span><span style="color: rgb(192, 192, 192); ">\</span><span style="color: rgb(192, 192, 192); ">&amp;</span><span style="color: rgb(192, 192, 192); ">quot</span>;<span style="color: rgb(192, 192, 192); ">&amp;</span><span style="color: rgb(192, 192, 192); ">quot</span>;<span style="color: rgb(187, 187, 0); ">&quot; . get_permalink(</span><span style="color: rgb(187, 187, 0); ">$comment-&gt;ID</span><span style="color: rgb(187, 187, 0); ">).&quot;</span><span style="color: rgb(105, 105, 105); ">#comment-&quot; . $comment-&gt;comment_ID . &quot;\" title=\"on ".$comment-&gt;post_title . "\"&gt;".strip_tags($comment-&gt;comment_author)."&lt;/a&gt;" .": " .strip_tags($comment-&gt;com_excerpt)."&lt;/li&gt;"; </span><br /> <span style="color: rgb(192, 192, 192); ">}</span> </p>
<p> <span style="color: rgb(204, 204, 0); ">$output</span> <span style="color: rgb(192, 192, 192); ">.=</span> <span style="color: rgb(204, 204, 0); ">$post_HTML</span>; <br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">echo</span> <span style="color: rgb(204, 204, 0); ">$output</span>; <br /> <span style="color: rgb(255, 255, 255); ">?&gt;</span></div>
<p>特注明此代码适用于侧边栏，如使用在single页文章一下的话，建议使用WordPress中文工具箱插件！因为此代码会一起评论页标题的错误！</p>
]]></content:encoded>
			<wfw:commentRss>http://fvf.me/wordpress/theme/the-latest-post-co-wordpress-themede.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress主题模板函数</title>
		<link>http://fvf.me/wordpress/theme/wordpress-theme-template-function.html</link>
		<comments>http://fvf.me/wordpress/theme/wordpress-theme-template-function.html#comments</comments>
		<pubDate>Wed, 05 Aug 2009 08:23:51 +0000</pubDate>
		<dc:creator>死兔子</dc:creator>
				<category><![CDATA[主题]]></category>
		<category><![CDATA[代码]]></category>
		<category><![CDATA[函数]]></category>

		<guid isPermaLink="false">http://fvf.me/wordpress/wordpress%e4%b8%bb%e9%a2%98%e6%a8%a1%e6%9d%bf%e5%87%bd%e6%95%b0.html</guid>
		<description><![CDATA[我也修改了很多的主题，对主题中所写的一些数据库查询语句也有了一些认识！找出来给那些要修改主题的人！ WordPress基本模板文件 style.css : CSS(样式表)文件 index.php : 主页模板 archive.php : Archive/Category模板 404.php : 404页面，错误页模板 comments.php : 留言/回复模板 footer.php : Footer模板 header.php : Header模板 sidebar.php : 侧栏模板 page.php : 内容页(Page)模板 single.php : 内容页(Post)模板 searchform.php : 搜索表单模板 search.php : 搜索结果模板 基本条件判断Tag is_home() : 是否为主页 is_single() : 是否为内容页(Post) is_page() : 是否为内容页(Page) is_category() : 是否为Category/Archive页 is_tag() : 是否为Tag存档页 is_date() [...]]]></description>
			<content:encoded><![CDATA[<p>我也修改了很多的主题，对主题中所写的一些数据库查询语句也有了一些认识！找出来给那些要修改主题的人！</p>
<blockquote><p>WordPress基本模板文件      <br />style.css : CSS(样式表)文件       <br />index.php : 主页模板       <br />archive.php : Archive/Category模板       <br />404.php : 404页面，错误页模板       <br />comments.php : 留言/回复模板       <br />footer.php : Footer模板       <br />header.php : Header模板       <br />sidebar.php : 侧栏模板       <br />page.php : 内容页(Page)模板       <br />single.php : 内容页(Post)模板       <br />searchform.php : 搜索表单模板       <br />search.php : 搜索结果模板</p>
</blockquote>
<blockquote><p>基本条件判断Tag      <br />is_home() : 是否为主页       <br />is_single() : 是否为内容页(Post)       <br />is_page() : 是否为内容页(Page)       <br />is_category() : 是否为Category/Archive页       <br />is_tag() : 是否为Tag存档页       <br />is_date() : 是否为指定日期存档页       <br />is_year() : 是否为指定年份存档页       <br />is_month() : 是否为指定月份存档页       <br />is_day() : 是否为指定日存档页       <br />is_time() : 是否为指定时间存档页       <br />is_archive() : 是否为存档页       <br />is_search() : 是否为搜索结果页       <br />is_404() : 是否为 “HTTP 404: Not Found” 错误页       <br />is_paged() : 主页/Category/Archive页是否以多页显示</p>
</blockquote>
<blockquote><p>Header部分常用到的PHP函数      <br />&lt;?php bloginfo('name'); ?&gt; : 博客名称(Title)       <br />&lt;?php bloginfo('stylesheet_url'); ?&gt; : CSS文件路径       <br />&lt;?php bloginfo('pingback_url'); ?&gt; : PingBack Url       <br />&lt;?php bloginfo('template_url'); ?&gt; : 模板文件路径       <br />&lt;?php bloginfo('version'); ?&gt; : WordPress版本       <br />&lt;?php bloginfo('atom_url'); ?&gt; : Atom Url       <br />&lt;?php bloginfo('rss2_url'); ?&gt; : RSS 2.o Url       <br />&lt;?php bloginfo('url'); ?&gt; : 博客 Url       <br />&lt;?php bloginfo('html_type'); ?&gt; : 博客网页Html类型       <br />&lt;?php bloginfo('charset'); ?&gt; : 博客网页编码       <br />&lt;?php bloginfo('description'); ?&gt; : 博客描述       <br />&lt;?php wp_title(); ?&gt; : 特定内容页(Post/Page)的标题</p>
</blockquote>
<blockquote><p>模板常用的PHP函数及命令      <br />&lt;?php get_header(); ?&gt; : 调用Header模板       <br />&lt;?php get_sidebar(); ?&gt; : 调用Sidebar模板       <br />&lt;?php get_footer(); ?&gt; : 调用Footer模板       <br />&lt;?php the_content(); ?&gt; : 显示内容(Post/Page)       <br />&lt;?php if(have_posts()) : ?&gt; : 检查是否存在Post/Page       <br />&lt;?php while(have_posts()) : the_post(); ?&gt; : 如果存在Post/Page则予以显示       <br />&lt;?php endwhile; ?&gt; : While 结束       <br />&lt;?php endif; ?&gt; : If 结束       <br />&lt;?php the_time('字符串') ?&gt; : 显示时间，时间格式由“字符串”参数决定，具体参考PHP手册       <br />&lt;?php comments_popup_link(); ?&gt; : 正文中的留言链接。如果使用 comments_popup_script() ，则留言会在新窗口中打开，反之，则在当前窗口打开       <br />&lt;?php the_title(); ?&gt; : 内容页(Post/Page)标题       <br />&lt;?php the_permalink() ?&gt; : 内容页(Post/Page) Url       <br />&lt;?php the_category(', ') ?&gt; : 特定内容页(Post/Page)所属Category       <br />&lt;?php the_author(); ?&gt; : 作者       <br />&lt;?php the_ID(); ?&gt; : 特定内容页(Post/Page) ID       <br />&lt;?php edit_post_link(); ?&gt; : 如果用户已登录并具有权限，显示编辑链接       <br />&lt;?php get_links_list(); ?&gt; : 显示Blogroll中的链接       <br />&lt;?php comments_template(); ?&gt; : 调用留言/回复模板       <br />&lt;?php wp_list_pages(); ?&gt; : 显示Page列表       <br />&lt;?php wp_list_categories(); ?&gt; : 显示Categories列表       <br />&lt;?php next_post_link('%link'); ?&gt; : 下一篇文章链接       <br />&lt;?php previous_post_link('%link'); ?&gt; : 上一篇文章链接       <br />&lt;?php get_calendar(); ?&gt; : 日历       <br />&lt;?php wp_get_archives() ?&gt; : 显示内容存档       <br />&lt;?php posts_nav_link(); ?&gt; : 导航，显示上一篇/下一篇文章链接       <br />&lt;?php include(TEMPLATEPATH . '/文件名'); ?&gt; : 嵌入其他文件，可为定制的模板或其他类型文件</p>
</blockquote>
<blockquote><p>与模板相关的其他函数      <br />&lt;?php _e('Message'); ?&gt; : 输出相应信息       <br />&lt;?php wp_register(); ?&gt; : 显示注册链接       <br />&lt;?php wp_loginout(); ?&gt; : 显示登录/注销链接       <br />&lt;!–next page–&gt; : 将当前内容分页       <br />&lt;!–more–&gt; : 将当前内容截断，以不在主页/目录页显示全部内容       <br />&lt;?php timer_stop(1); ?&gt; : 网页加载时间(秒)       <br />&lt;?php echo get_num_queries(); ?&gt; : 网页加载查询量</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://fvf.me/wordpress/theme/wordpress-theme-template-function.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>改写404页面之Inove 主题</title>
		<link>http://fvf.me/wordpress/theme/404-pages-inove-rewrite-of-the-theme.html</link>
		<comments>http://fvf.me/wordpress/theme/404-pages-inove-rewrite-of-the-theme.html#comments</comments>
		<pubDate>Wed, 05 Aug 2009 07:46:33 +0000</pubDate>
		<dc:creator>死兔子</dc:creator>
				<category><![CDATA[主题]]></category>
		<category><![CDATA[404]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[inove]]></category>

		<guid isPermaLink="false">http://fvf.me/wordpress/%e6%94%b9%e5%86%99404%e9%a1%b5%e9%9d%a2%e4%b9%8binove-%e4%b8%bb%e9%a2%98.html</guid>
		<description><![CDATA[改写404页面 这主题 有一个小秘密，就是404页面了，里面还有MG12那个咸湿佬的图片和网站链接。建议大家改一下404页面，很不客气的把他的图片和链接给该了，当然了footer的MG12的链接，还是留着的，做人还是要厚道的。这也是国际惯例了吧！表示对作者的谢意！我把Google的404页面代码也加上去了，代码如下： &#60;script type=&#34;text/javascript&#34;&#62; var GOOG_FIXURL_LANG = &#39;zh-CN&#39;; var GOOG_FIXURL_SITE = &#39;http://fvf.me/&#39;;&#60;/script&#62; &#60;script type=&#34;text/javascript&#34; src=&#34;http://linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js&#34;&#62;&#60;/script&#62; 把其中的http://fvf.me 改一下就可以了。这样当用户访问到404页面的时候会出现Google的搜索条，进行网站的内部搜索！方便用户进行查找!&#160;&#160;]]></description>
			<content:encoded><![CDATA[<p><strong>改写404页面</strong></p>
<p>这主题 有一个小秘密，就是404页面了，里面还有MG12那个咸湿佬的图片和网站链接。建议大家改一下404页面，很不客气的把他的图片和链接给该了，当然了footer的MG12的链接，还是留着的，做人还是要厚道的。这也是国际惯例了吧！表示对作者的谢意！我把Google的404页面代码也加上去了，代码如下：</p>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', Verdana; color: rgb(192, 192, 192); background-color: rgb(0, 0, 0); "> <span style="color: rgb(192, 192, 192); ">&lt;</span><span style="color: rgb(192, 192, 192); ">script</span> <span style="color: rgb(192, 192, 192); ">type</span><span style="color: rgb(192, 192, 192); ">=</span><span style="color: rgb(187, 187, 0); ">&quot;text/javascript&quot;</span><span style="color: rgb(192, 192, 192); ">&gt;</span><br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">var</span> <span style="color: rgb(192, 192, 192); ">GOOG_FIXURL_LANG</span> <span style="color: rgb(192, 192, 192); ">=</span> <span style="color: rgb(187, 187, 0); ">&#39;zh-CN&#39;</span>;<br /> <span style="color: rgb(255, 255, 0); font-weight: bold; ">var</span> <span style="color: rgb(192, 192, 192); ">GOOG_FIXURL_SITE</span> <span style="color: rgb(192, 192, 192); ">=</span> <span style="color: rgb(187, 187, 0); ">&#39;http://fvf.me/&#39;</span>;<span style="color: rgb(192, 192, 192); ">&lt;</span><span style="color: rgb(192, 192, 192); ">/script&gt;</span><br /> <span style="color: rgb(192, 192, 192); ">&lt;</span><span style="color: rgb(192, 192, 192); ">script</span> <span style="color: rgb(192, 192, 192); ">type</span><span style="color: rgb(192, 192, 192); ">=</span><span style="color: rgb(187, 187, 0); ">&quot;text/javascript&quot;</span> <span style="color: rgb(192, 192, 192); ">src</span><span style="color: rgb(192, 192, 192); ">=</span><span style="color: rgb(187, 187, 0); ">&quot;http://linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js&quot;</span><span style="color: rgb(192, 192, 192); ">&gt;&lt;</span><span style="color: rgb(192, 192, 192); ">/script&gt;</span></div>
<p>把其中的http://fvf.me 改一下就可以了。这样当用户访问到404页面的时候会出现Google的搜索条，进行网站的内部搜索！方便用户进行查找!&#160;&#160; </p>
]]></content:encoded>
			<wfw:commentRss>http://fvf.me/wordpress/theme/404-pages-inove-rewrite-of-the-theme.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

