<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2chinesetwfull.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>精品博客</title>
	
	<link>http://www.essentialblog.cn</link>
	<description>精品博客，关注博客，评论博客，服务博客。</description>
	<lastBuildDate>Sat, 11 Jul 2009 22:45:35 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" /><image><link>http://www.essentialblog.cn/</link><url>http://www.essentialblog.cn/image/cc.gif</url><title>转载请遵循“署名-非商业性使用”的创作协议</title></image><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/e-blog" type="application/rss+xml" /><feedburner:emailServiceId>e-blog</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><feedburner:feedFlare href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Ffeeds.feedburner.com%2Fe-blog" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare href="http://www.bloglines.com/sub/http://feeds.feedburner.com/e-blog" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2Fe-blog" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>精博第三次更换 WordPress 主题</title>
		<link>http://feedproxy.google.com/~r/e-blog/~3/_CCj6ZN8YDQ/</link>
		<comments>http://www.essentialblog.cn/third-new-wordpress-theme/#comments</comments>
		<pubDate>Sat, 11 Jul 2009 22:45:35 +0000</pubDate>
		<dc:creator>Young</dc:creator>
				<category><![CDATA[博客历史]]></category>
		<category><![CDATA[Thematic]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[主题]]></category>

		<guid isPermaLink="false">http://www.essentialblog.cn/?p=2738</guid>
		<description><![CDATA[当我弄明白 “主题 = Theme = 博客的皮肤”的时候，却又发现 “Topic” 和 “Theme” 都翻译成 “主题”，我就愣住了。]]></description>
			<content:encoded><![CDATA[<p>
<p>2007 年，我开始接触 WordPress 并开始用它来写博客。</p>
<p>当我弄明白 “主题 = Theme = 博客的皮肤”的时候，却又发现 “Topic” 和 “Theme” 都翻译成 “主题”，我就愣住了。因为博客的主题和 WordPress 的主题是两个不同的概念，前者表示博客涉及的话题及主要内容，而后者则是指博客的外观。</p>
<p>这次精博更换的是 WordPress 主题，而不是博客主题，精博将会一直围绕着 “关注博客、评论博客、服务博客” 的主题写下去，但是博客的外观则可能会更改。</p>
<p>精博最开始用的是 WordPress 的默认主题，记得那个时候 FeedSky 还在举办<a href="http://www.essentialblog.cn/feedsky-contest/">博客大赛</a>。那次大赛我参加了，比赛结束后 FeedSky 送了我一本书和一个咖啡机。赛后不久，我就把默认的 WordPress 主题换成<a href="http://www.essentialblog.cn/qian-blogger/">前～博客</a>修改过的主题 —— <a href="http://www.essentialblog.cn/to-put-on-a-new-wp-theme/">typoxp-reloaded</a>。那个时候前～博客已经不怎么更新了，但是还可以访问。现在前～博客不可以访问了，如果有朋友还在使用它修改的主题，记得把页脚的主题链接去掉。typoxp-reloaded 我大概用了一年。 </p>
<p>去年是我的幸运年，虽然没有发财，但是却中了不少奖，其中一个就是 UBD 赠送的 <a href="http://www.essentialblog.cn/i-win-a-citrus-theme-from-ubd/">Citrus Theme</a> 主题——后来就成了精博的第三个主题，一直用到上个月。Citrus Theme 原来是卖几十块美金一个的，UBD 不给我分享，后来不久就免费了。如果您想要却找不到，可以留言或者发邮件给我，我再发给你。</p>
<p>Citrus Theme 免费后，我对它也就厌倦了，于是又想换主题，但这次我想自己动手做一个。刚好前阵子有一个叫 Ian 的老外在教别人<a href="http://www.essentialblog.cn/wordpress-themes-templates-tutorial/">如何制作 WordPress 主题</a>，于是我就跟着学了。我把老外的整个系列都翻译完了，也跟着他的教程一步一步一个模板一个模板地创建，最后发现自己做出来的主题和他之前提供的样版 （<a href="http://themeshapes.com/shape/">shape</a>) 是一模一样的，都是不能用的。为什么呢？因为那个主题上的 H1、H2、H3、H4、H5、H6 的字体都是一样的大！我想修复这个 Bug，可是至今仍然无解。</p>
<p>就在我翻译的同时，不小心发现了那个老外的招牌主题 —— Thematic，这个主题是免费的，并且具有以下两大优点：</p>
<p>1、在 WordPress 后台的小工具 （Widgets) 页面，您可以在侧边栏、静态页面的上下部、主页和单独日志的上中下三个位置、以及页脚的左中右三个位置插入小工具。</p>
<p>2、布局分两栏和三栏，一共有 5 种不同的效果供选择。</p>
<p>看到这两大优点加上黑白的配色，我就放弃了自己动手设计主题的念头了，况且老外自己的博客也是用这个主题，所以我也就直接用来做精博的第四个主题了。</p>
<p>如果您喜欢精博目前这个主题，可以<a href="http://themeshaper.com/thematic/" class="broken_link" >点击这里</a>下载。另外，我对这个主题进行了汉化，如果您喜欢，可以<a href="http://www.essentialblog.cn/go/languages-cn.rar">点击这里</a>下载汉化文件，然后拷贝到该主题的 languages 文件夹里，然后使用中文版的 WordPress 或者把英文版的 WordPress 根目录里面的 wp-config.php 文件中的下面代码：</p>
<p><code>define ('WPLANG', '');</code></p>
<p>改成：</p>
<p><code>define ('WPLANG', 'zh_CN');</code></p>
<p align="left">-------------------------------------</p><br />
 <p align="left">&copy; 逛逛<a href="http://www.essentialblog.cn/">精品博客</a>，看看博客精品。| 转载请遵循“<a href="http://creativecommons.org/licenses/by-nc/2.5/cn/">署名-非商业性使用</a>”的创作共用协议。</p><br />
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/e-blog?a=_CCj6ZN8YDQ:xXG6b01wNWM:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/e-blog?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/e-blog?a=_CCj6ZN8YDQ:xXG6b01wNWM:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/e-blog?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/e-blog?a=_CCj6ZN8YDQ:xXG6b01wNWM:R_Hd-r7sPaA"><img src="http://feeds.feedburner.com/~ff/e-blog?d=R_Hd-r7sPaA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/e-blog/~4/_CCj6ZN8YDQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.essentialblog.cn/third-new-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.essentialblog.cn/third-new-wordpress-theme/</feedburner:origLink></item>
		<item>
		<title>如何抓取电脑屏幕图片或视频?</title>
		<link>http://feedproxy.google.com/~r/e-blog/~3/xGEILv-KtHc/</link>
		<comments>http://www.essentialblog.cn/how-to-capture-pic-or-video-of-sites/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 22:39:55 +0000</pubDate>
		<dc:creator>Young</dc:creator>
				<category><![CDATA[博客技术]]></category>
		<category><![CDATA[QQ]]></category>
		<category><![CDATA[SnagIt]]></category>
		<category><![CDATA[屏幕]]></category>
		<category><![CDATA[截图]]></category>

		<guid isPermaLink="false">http://www.essentialblog.cn/?p=2753</guid>
		<description><![CDATA[如果我要在博客上教别人做一件事，通常采取两种表达方式：一是图片加文字，来个图文并茂，例如 WordPress 安装教程；要不就是来个视频，图个全程记录，例如黑莓刷机教程。]]></description>
			<content:encoded><![CDATA[<p></p>
<p><img src="http://www.essentialblog.cn/image/Screenjelly.jpg" alt="sceenjelly" width="540" height="344" hspace="0" vspace="5"></p>
<p>如果我要在博客上教别人做一件事，通常采取两种表达方式：一是图片加文字，来个图文并茂，例如 <a href="http://www.essentialblog.cn/how-to-install-wordpress/">WordPress 安装教程</a>；要不就是来个视频，图个全程记录，例如<a href="http://www.essentialblog.cn/how-to-update-blackberry-os/">黑莓刷机教程</a>。</p>
<p>而所用的图片和视频都是从电脑屏幕前抓取而来的，那么，如何抓取呢？下面是我的做法：</p>
<h2>一、如何截取电脑屏幕图片？</h2>
<p>Wordpress 安装教程的图片效果不是很好，因为是用<strong> QQ </strong>截的图，后来发现了一个 <a href="http://www.techsmith.com/screen-capture.asp"><strong>SnagIt</strong></a> 软件，截图效果很好（例如这篇文章里的截图），但是不能截取跳出窗口（如 QQ 弹出的新闻窗口）；所以现在我用 SnagIt 来截取页面视图,而用 QQ 来截取弹出窗口。</p>
<p>如果您不喜欢在电脑上安装软件，那么可以试试 <a href="http://www.superscreenshot.com/"><strong>Super Screenshot</strong><strong> </strong></a>这个提供在线截图服务的网站，不过网速不能太慢。</p>
<h2>二、如何录制电脑屏幕视频？</h2>
<p>至于黑莓刷机视频教程，我自认为效果是很不错的，因为清晰度还可以，如果下载来看那就是完美了。这种效果要归功于 <a href="http://www.bbsoftware.co.uk/"><strong>BB FlashBack</strong></a> 这个软件。</p>
<p>BB FlashBack 是一款非常优秀的屏幕视频录制工具，录制的视频可以转化为 swf、flv、avi 等多种格式。 </p>
<p>不过值得注意的是，SnagIt 和 BB FalshBack 的免费版都是有功能限制的，所以我建议您使用付费版的，如果您和我一样不舍得花钱，可以试用 30 天后重装系统，或者到谷歌和百度搜索破解版的，当然，如果您能找到免费的注册码那就更厉害了。</p>
<p>同样，也有一个提供在线录制屏幕视频服务的网站 —— <a href="http://www.screenjelly.com/"><strong>Screenjelly</strong></a>，但是您要先安装最新版的 Flash Player 和 Java 这两个软件。通过 Screenjelly，您可以录制屏幕视频并发送到 Twitte、facebook 等社会媒体，但前提是您需要先验证 Twitter 帐号。现在 Twitter <a href="http://www.essentialblog.cn/fuck-gfw-history/">被墙</a>，想必没有多少国人有那个雅兴了。</p>
<p>您如有更好的抓取电脑屏幕图片或视频的方法，欢迎分享。 </p>
<p align="left">-------------------------------------</p><br />
 <p align="left">&copy; 逛逛<a href="http://www.essentialblog.cn/">精品博客</a>，看看博客精品。| 转载请遵循“<a href="http://creativecommons.org/licenses/by-nc/2.5/cn/">署名-非商业性使用</a>”的创作共用协议。</p><br />
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/e-blog?a=xGEILv-KtHc:mZpJu6dUYOU:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/e-blog?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/e-blog?a=xGEILv-KtHc:mZpJu6dUYOU:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/e-blog?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/e-blog?a=xGEILv-KtHc:mZpJu6dUYOU:R_Hd-r7sPaA"><img src="http://feeds.feedburner.com/~ff/e-blog?d=R_Hd-r7sPaA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/e-blog/~4/xGEILv-KtHc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.essentialblog.cn/how-to-capture-pic-or-video-of-sites/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.essentialblog.cn/how-to-capture-pic-or-video-of-sites/</feedburner:origLink></item>
		<item>
		<title>对付死链接的 5 种方式</title>
		<link>http://feedproxy.google.com/~r/e-blog/~3/lJbfbgtUrPs/</link>
		<comments>http://www.essentialblog.cn/5-ways-to-fuck-broken-links/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 21:35:43 +0000</pubDate>
		<dc:creator>Young</dc:creator>
				<category><![CDATA[博客技术]]></category>
		<category><![CDATA[Broken Link]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[死链接]]></category>

		<guid isPermaLink="false">http://www.essentialblog.cn/?p=2752</guid>
		<description><![CDATA[如果您的博客上有 1000 个死链接，您大概会发疯，其实精博上的 100 来个死链接已经差点让我发疯了。]]></description>
			<content:encoded><![CDATA[<p></p>
<p>如果您的博客上有 1000 个死链接，您大概会发疯，其实精博上的 100 来个死链接已经差点让我发疯了。</p>
<p>那么什么是死链接呢？据网络记载，死链接，也叫断链、坏链接或者无效链接，英文名称叫做 Broken Link 或者 Dead Link，指的是访问不了的链接。</p>
<p>链接访问不了大概有三种可能：</p>
<p><strong>一是链接一开始就错了。</strong></p>
<p>比如，精博的链接是 essentialblog.cn，有一次我居然打成了 esentialblog.cn。</p>
<p><strong>二是原来那个网页不见了。</strong></p>
<p>点击链接出现 404 错误提示页面就属于这种情况。</p>
<p><strong>三是原来那个网站挂了。</strong></p>
<p>比如，曾叱咤博坛的<a href="http://www.essentialblog.cn/qian-blogger/">前～博客</a>，域名是 qianblogger.com，现在访问就只能看到 “Apache is functioning normally” 了。</p>
<p>一个博客的死链接数量和 PR 值以及读者的好感是成反比的，所以人人都狠死链接——竞争对手博客上的不算——如果您有竞争对手的话。 </p>
<p>那么，如何对付死链接呢？首先要先找到死链接，怎么找呢？这里有五种方式供您选择：</p>
<p><strong><a href="http://home.snafu.de/tilman/xenulink.html">1、Xenu</a></strong></p>
<p><img src="http://www.essentialblog.cn/image/xenu.jpg" alt="Xune" width="540" height="554" hspace="0" vspace="5"></p>
<p>Xune 是一个免费的桌面软件，会检测您整个网站的所有链接，并告诉您哪些是好的、哪些是死的、哪些是超时的以及哪些是暂时无法连接上的，然后还会生成一份详细的报告给您，不过那些报告我还从未看完过——因为链接太多了。</p>
<p><a href="http://www.dead-links.com/"><strong>2、Dead Links </strong></a></p>
<p><img src="http://www.essentialblog.cn/image/dead-link.jpg" alt="dead links" width="540" height="567" hspace="0" vspace="5"></p>
<p>Dead Links 是一个提供免费链接检测服务的网站，也可以检查您博客所有的链接，检测结果分为内链接、外链接和未验证链接三种。整体效果比 Xenu 差一点。</p>
<p><a href="http://www.linktiger.com/"><strong>3、Linktiger</strong></a></p>
<p><img src="http://www.essentialblog.cn/image/linktiger.jpg" alt="Link Tiger" width="540" height="331" hspace="0" vspace="5"></p>
<p>Linktiger，名字挺牛逼的，主要服务为每周或者每天固定把您博客链接的死活情况发送到您的邮箱，可惜免费的帐户只能检测 1000 个链接，太小气了。 </p>
<p><a href="http://www.linkpatch.com/"><strong>4、Linkpatch</strong></a></p>
<p><img src="http://www.essentialblog.cn/image/linkpatch.jpg" alt="Linkpatch" width="540" height="289" hspace="0" vspace="5"></p>
<p>这个是我昨天发现的，很好玩。您注册了之后把一段代码复制粘贴到您的 404 模板（404.php)，然后您的博客一旦出现 404 页面，Linkpatch 就会把这个消息通过邮件发送给您，算是错误报告吧。</p>
<p><a href="http://wordpress.org/extend/plugins/broken-link-checker/"><strong>5、Broken Link Checker </strong></a></p>
<p><img src="http://www.essentialblog.cn/image/broken-link-checker.jpg" alt="Broken Link Checker" width="540" height="204" hspace="0" vspace="5"></p>
<p>Broken Link Checker 是一个 WordPress 插件，也是我目前最喜欢的死链接检测软件。它的优势在于不仅可以检测所有文章的死链接和重置链接，而且还可以直接在 WordPress 后台对这些链接进行修改。不过有一个不足的地方是，它只在您的 WordPress 后台开着的时候才会检测，大懒虫一个。</p>
<p>另外，要特别注意的是，上面这些分析工具都不是 100% 可靠的，因为访问超时的或者<a href="http://www.essentialblog.cn/what-happened-to-these-gfw-fuckers/">被墙</a>的链接也会被它们判为死链接。其实，访问超时只是表示当时网络速度慢，而被墙则表示某个地区不能访问而已。</p>
<p>那么，找到真正的死链接之后该如何把它们删除呢？这里提供三种方法供您参考：</p>
<p><strong>1、使用 Broken Link Checker 插件</strong></p>
<p>不错，就是前面提到的 Broken Link Checker 插件，集检测和删除功能于一身，很强大。</p>
<p><strong>2、通过 WordPress 后台修改</strong></p>
<p>如果您知道哪篇文章里面哪些链接已经死掉了，登录 WordPress 后台直接删掉。</p>
<p><strong>3、通过 phpMyAdmin 修改</strong></p>
<p>登录 cPanel 后台的 phpMyAdmin 页面后，通过搜索功能找到死链接所在的文章并进行修改。</p>
<p>衷心祝愿所有的死链接死光光。如果您还有更好的对付死链接的方法，欢迎分享。</p>
<p align="left">-------------------------------------</p><br />
 <p align="left">&copy; 逛逛<a href="http://www.essentialblog.cn/">精品博客</a>，看看博客精品。| 转载请遵循“<a href="http://creativecommons.org/licenses/by-nc/2.5/cn/">署名-非商业性使用</a>”的创作共用协议。</p><br />
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/e-blog?a=lJbfbgtUrPs:mkS0i3pvfJ4:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/e-blog?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/e-blog?a=lJbfbgtUrPs:mkS0i3pvfJ4:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/e-blog?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/e-blog?a=lJbfbgtUrPs:mkS0i3pvfJ4:R_Hd-r7sPaA"><img src="http://feeds.feedburner.com/~ff/e-blog?d=R_Hd-r7sPaA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/e-blog/~4/lJbfbgtUrPs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.essentialblog.cn/5-ways-to-fuck-broken-links/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.essentialblog.cn/5-ways-to-fuck-broken-links/</feedburner:origLink></item>
		<item>
		<title>如何创建 WordPress 主题 CSS 样式表</title>
		<link>http://feedproxy.google.com/~r/e-blog/~3/P6oL0JtBIJM/</link>
		<comments>http://www.essentialblog.cn/reset-rebuild-wordpress-theme-css-define-layouts/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 20:44:23 +0000</pubDate>
		<dc:creator>Young</dc:creator>
				<category><![CDATA[博客技术]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[主题]]></category>
		<category><![CDATA[样式表]]></category>

		<guid isPermaLink="false">http://www.essentialblog.cn/?p=2749</guid>
		<description><![CDATA[CSS 可以很复杂，也可以很简单。我开始学习 CSS 的时候，获得很多帮助，所以我也很乐意把经验告诉别人：从代码漂亮的例子中学习。]]></description>
			<content:encoded><![CDATA[<p></p>
<p><em>原文：<a href="http://themeshaper.com/reset-rebuild-wordpress-theme-css-define-layouts/">How To Reset &amp; Rebuild WordPress Theme CSS &amp; Define Your Layouts</a></em></p>
<p><em>原文作者：Ian Stewart</em></p>
<p><em>译文：<a href="http://www.essentialblog.cn/reset-rebuild-wordpress-theme-css-define-layouts/">如何创建 WordPress 主题 CSS 样式表</a></em></p>
<p><em>译文作者：Young</em></p>
<p>CSS 可以很复杂，也可以很简单。我开始学习 CSS 的时候，获得很多帮助，所以我也很乐意把经验告诉别人：从代码漂亮的例子中学习。</p>
<p>这里我们将为您布局一个 WordPress 主题 CSS 开发的数据库：</p>
<ul>
<li>一个使得主题适合所有浏览器的样式表，并且创建一个合理的标准；</li>
<li>另外一个通过巧妙方式更改我们的排版布局的样式表；</li>
<li>一个只适合 WordPress 属性的样式表（保持前面两个样式表的独立性以便以后用于非 WordPress 平台上）；</li>
<li>6 个您能想到的适合所有普通博客和网站布局的流动样式表——并且每个样式表都可调整页面的宽度。 </li>
</ul>
<p>我们这里用到的所有代码都是开源的，符合 GPL 协议，并且都可以在 <a href="http://code.google.com/p/your-wordpress-theme/source/browse/#svn/trunk/styles">Your Theme Project 页面</a>看到。您可以随便阅读、复制和粘帖其中任何的文件。</p>
<p>重要的事情先做，先在您的主题根目录下新建一个 “styles”文件夹，那 6 个样式表都会放在这个新文件夹里面，准备好制作那些 CSS 文件了吗？</p>
<h2>Reset&nbsp;CSS</h2>
<p>这个 Reset CSS 只是在 <a href="http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/">Eric Meyer 著名的 Reset CSS</a> 基础上稍微做了点修改，它的作用在于使您的主题适合各种浏览器。</p>
<p>它很漂亮，照顾到了每个浏览者的兴趣，让您不必担心读者通过什么浏览器访问您的博客。</p>
<p>它的使用很简单，在 style.css 最顶部的注释下面添加以下代码： </p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2749code1'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p27491"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2749code1"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/* Reset default browser styles */</span>
<span style="color: #339933;">@</span>import url<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'styles/reset.css'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>重新加载你的网页，看看 <a href="http://your-wordpress-theme.googlecode.com/svn/trunk/styles/reset.css">reset.css</a> 在各种浏览器下的表现（如果您可以的话），效果很奇妙，是吧？ </p>
<h2>Rebuild CSS </h2>
<p>这个 Rebuild CSS 是我根据早期的 BluePrint CSS 样式表发明的，并且在<a href="http://themeshaper.com/thematic/" class="broken_link" > Thematic 主题</a>里面加以完善了。这个 Rebuild CSS 的作用在于使页面的垂直边距有规律，方便调整。 </p>
<p>我这个 Rebuild CSS 的特色是把两种不同的网页样式结合起来，即字体大小用 px，并采用相对行高，而其他的垂直边距（例如段落和列表）则使用 em。 </p>
<p>这是什么意思呢？这方便您以后修改字体的大小——不需要做任何计算——其他的排版因素（例如段落和清单）就会自动调整垂直边距。</p>
<p> <a href="http://your-wordpress-theme.googlecode.com/svn/trunk/styles/rebuild.css"><code>rebuild.css</code></a> 的使用也很简单，在 reset.css 导入后添加以下代码：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2749code2'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p27492"><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code" id="p2749code2"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/* Rebuild default browser styles */</span>
&nbsp;
<span style="color: #339933;">@</span>import url<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'styles/rebuild.css'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<h2>基本的 WordPress 格式</h2>
<p>WordPress 里面有我们每次都需要用到的格式，我所做的就是通过一个叫做 wp.css 的文件调用它们。 </p>
<p>现在我们需要设定所有图片的排列方式——包括标题和画廊，同时设定引用的格式。您所需要做的只是为 blockquote 标签添加一个左对齐或者右对齐的 Class 属性。</p>
<p>您能猜测我们将如何使用 <a href="http://your-wordpress-theme.googlecode.com/svn/trunk/styles/wp.css"><code>wp.css</code></a> 吗？ </p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2749code3'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p27493"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2749code3"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/* Basic WordPress Styles */</span>
<span style="color: #339933;">@</span>import url<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'styles/wp.css'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<h2>您需要的所有布局</h2>
<p>对您的新主题，我已经采取了坚如磐石的布局，这个布局建立在 Sandbox 主题的基础上并且适合您的新 HTML 结构。一共有 <a href="http://your-wordpress-theme.googlecode.com/svn/trunk/styles/">6 种布局</a>，其中每一种布局都是流动的（即宽度可以伸缩到符合您的浏览器窗口大小），并且可以简单地固定布局的宽度。</p>
<p>这些布局的使用都很简单。在导入基本的布局注释语下面直接导入其中一个布局就好了，下面就是导入正文在中间的三栏布局的代码：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2749code4'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p27494"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2749code4"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/* Import a basic layout */</span>
<span style="color: #339933;">@</span>import url<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'styles/3c-b.css'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>最简单的固定布局宽度的方法是在 wrapper div 标签里面添加 width 和 margin 属性：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2749code5'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p27495"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p2749code5"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#wrapper {
</span>
  margin<span style="color: #339933;">:</span> <span style="color: #cc66cc;">0</span> auto<span style="color: #339933;">;</span>
  width<span style="color: #339933;">:</span> 960px<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h3>额外收获：格式化菜单</h3>
<p>作为一种奖励，如果您从未创建一个无序的列表（由 <a href="http://codex.wordpress.org/Template_Tags/wp_page_menu">wp_page_menu</a> 自动生成的）并且想让这个列表好看一点，可以参考下面我创建 WordPress 主题时所用的代码：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2749code6'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p27496"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
</pre></td><td class="code" id="p2749code6"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#access {
</span>
	margin<span style="color: #339933;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span> 1<span style="color: #339933;">.</span>5em <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
	overflow<span style="color: #339933;">:</span> auto<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">.</span>skip<span style="color: #339933;">-</span><span style="color: #990000;">link</span> <span style="color: #009900;">&#123;</span>
	display<span style="color: #339933;">:</span> none<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">.</span>menu ul <span style="color: #009900;">&#123;</span>
	list<span style="color: #339933;">-</span>style<span style="color: #339933;">:</span> none<span style="color: #339933;">;</span>
&nbsp;
	margin<span style="color: #339933;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">.</span>menu ul ul <span style="color: #009900;">&#123;</span>
	display<span style="color: #339933;">:</span> none<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">.</span>menu li <span style="color: #009900;">&#123;</span>
	display<span style="color: #339933;">:</span> inline<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">.</span>menu a <span style="color: #009900;">&#123;</span>
&nbsp;
	display<span style="color: #339933;">:</span> block<span style="color: #339933;">;</span>
	float<span style="color: #339933;">:</span> left<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>（以上代码插入于 style.css 文件中。——译者注）</p>
<p>很简单，但是毕竟我把您领入门了，祝您好运！</p>
<h2>如何创建 WordPress 主题</h2>
<p>这篇文章是<a href="http://www.essentialblog.cn/wordpress-themes-templates-tutorial/">如何创建 WordPress 主题教程系列</a>的其中一部分，该系列将会教您如何从零开始创建强大的 WordPress 主题。建议您从头开始阅读这个系列并自己动手编写一些漂亮的代码。</p>
<ol>
<li><a href="http://www.essentialblog.cn/wordpress-themes-templates-tutorial/">介绍</a>；</li>
<li><a href="http://www.essentialblog.cn/wordpress-theme-development-tools/">WordPress 主题开发工具</a>；</li>
<li><a href="http://www.essentialblog.cn/creating-wordpress-theme-html-structure-tutorial/">创建一个 HTML 结构</a>；</li>
<li><a href="http://www.essentialblog.cn/wordpress-theme-template-and-directory-structure/">模板和目录结构</a>；</li>
<li><a href="http://www.essentialblog.cn/wordpress-theme-header-template-tutorial/">Header 模板</a>；</li>
<li><a href="http://www.essentialblog.cn/wordpress-theme-index-template-tutorial/">Index 模板</a>；</li>
<li><a href="http://www.essentialblog.cn/wordpress-theme-single-post-post-attachment-404-templates-tutorial/">Single、Attachment 和 404 模板</a>；</li>
<li><a href="http://www.essentialblog.cn/wordpress-theme-comments-template-tutorial/">Comments 模板</a>；</li>
<li><a href="http://www.essentialblog.cn/wordpress-theme-search-page-template-tutorial/">Search 和 Page 模板</a>；</li>
<li><a href="http://www.essentialblog.cn/archive-author-category-tags-template/">Archive、Author、Category 和 Tag 模板</a>；</li>
<li><a href="http://www.essentialblog.cn/wordpress-theme-sidebar-template/">Sidebar 模板</a>；</li>
<li>如何创建 WordPress 主题 CSS 样式表。</li>
</ol>
<p>如果您对这个系列有任何的疑问或者建议，请留言告诉我。</p>
<p align="left">-------------------------------------</p><br />
 <p align="left">&copy; 逛逛<a href="http://www.essentialblog.cn/">精品博客</a>，看看博客精品。| 转载请遵循“<a href="http://creativecommons.org/licenses/by-nc/2.5/cn/">署名-非商业性使用</a>”的创作共用协议。</p><br />
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/e-blog?a=P6oL0JtBIJM:Y30pE11Nlmw:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/e-blog?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/e-blog?a=P6oL0JtBIJM:Y30pE11Nlmw:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/e-blog?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/e-blog?a=P6oL0JtBIJM:Y30pE11Nlmw:R_Hd-r7sPaA"><img src="http://feeds.feedburner.com/~ff/e-blog?d=R_Hd-r7sPaA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/e-blog/~4/P6oL0JtBIJM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.essentialblog.cn/reset-rebuild-wordpress-theme-css-define-layouts/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.essentialblog.cn/reset-rebuild-wordpress-theme-css-define-layouts/</feedburner:origLink></item>
		<item>
		<title>WordPress 主题之侧边栏模板</title>
		<link>http://feedproxy.google.com/~r/e-blog/~3/8-DciNcf8mM/</link>
		<comments>http://www.essentialblog.cn/wordpress-theme-sidebar-template/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 16:54:55 +0000</pubDate>
		<dc:creator>Young</dc:creator>
				<category><![CDATA[博客技术]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[主题]]></category>
		<category><![CDATA[侧边栏]]></category>
		<category><![CDATA[模板]]></category>

		<guid isPermaLink="false">http://www.essentialblog.cn/?p=2747</guid>
		<description><![CDATA[我知道你们在耐心地等待这个，大家都喜欢侧边栏模板，但是我们创建的侧边栏将和别人的有所不同，我们的会更漂亮一点。]]></description>
			<content:encoded><![CDATA[<p></p>
<p><em>原文：<a href="http://themeshaper.com/wordpress-theme-sidebar-template/">The WordPress Theme Sidebar Template</a></em></p>
<p><em>原文作者：Ian Stewart</em></p>
<p><em>译文：<a href="http://www.essentialblog.cn/wordpress-theme-sidebar-template/">WordPress 主题之侧边栏模板</a></em></p>
<p><em>译文作者：Young</em></p>
<p>我知道你们在耐心地等待这个，大家都喜欢侧边栏模板，但是我们创建的侧边栏将和别人的有所不同，我们的会更漂亮一点。</p>
<h2>自定义侧边栏功能</h2>
<p>重要的事情先做。对 WordPress 侧边栏模板，我们需要确保它是支持小工具 （Widget) 的。我们的侧边栏将会有两个小工具区域，这样我们就可以把代码重复利用于两栏或者三栏的主题，其中两栏主题的侧边栏是堆在一起的，其中一个在另一个的上面。</p>
<p>代码相当直接了当。在 functions.php 文件中插入以下代码：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2747code7'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p27477"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
</pre></td><td class="code" id="p2747code7"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Register widgetized areas</span>
<span style="color: #000000; font-weight: bold;">function</span> theme_widgets_init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// Area 1</span>
	register_sidebar<span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span>
&nbsp;
	<span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Primary Widget Area'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'id'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'primary_widget_area'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'before_widget'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;li id=&quot;%1$s&quot; class=&quot;widget-container %2$s&quot;&gt;'</span><span style="color: #339933;">,</span>
&nbsp;
	<span style="color: #0000ff;">'after_widget'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;&lt;/li&gt;&quot;</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'before_title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;h3 class=&quot;widget-title&quot;&gt;'</span><span style="color: #339933;">,</span>
&nbsp;
	<span style="color: #0000ff;">'after_title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;/h3&gt;'</span><span style="color: #339933;">,</span>
  <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Area 2</span>
&nbsp;
	register_sidebar<span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span>
	<span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Secondary Widget Area'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'id'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'secondary_widget_area'</span><span style="color: #339933;">,</span> 
	<span style="color: #0000ff;">'before_widget'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;li id=&quot;%1$s&quot; class=&quot;widget-container %2$s&quot;&gt;'</span><span style="color: #339933;">,</span>
&nbsp;
	<span style="color: #0000ff;">'after_widget'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;&lt;/li&gt;&quot;</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'before_title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;h3 class=&quot;widget-title&quot;&gt;'</span><span style="color: #339933;">,</span>
&nbsp;
	<span style="color: #0000ff;">'after_title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;/h3&gt;'</span><span style="color: #339933;">,</span>
  <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// end theme_widgets_init</span>
&nbsp;
&nbsp;
add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'init'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'theme_widgets_init'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>现在我们有两个小工具区域：<em>Primary</em> Widget 区域和 <em>Secondary</em> Widget 区域，他们的名字并不代表哪个重要哪个次要。在某些布局中，它们甚至并不用于侧边栏，但是它们仍然是小工具区域。</p>
<p>在 functions.php 我们还将添加两段超酷的自定义代码。</p>
<p><strong>首先，</strong>我们将预设默认小工具：搜索框、静态页面、分类目录、日志存档、链接和元。我们不需要把这些默认小工具的代码写在 sidebar.php 里，我们将令 WordPress 自动把它们添加到小工具区域（这里要感谢 <a href="http://ptahdunbar.com/wordpress/droppin-knowledge-on-wordpress-how-to-preset-widgets-to-widget-areas/">Ptah Dunbar</a>）。</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2747code8'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p27478"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code" id="p2747code8"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$preset_widgets</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span>
&nbsp;
	<span style="color: #0000ff;">'primary_widget_area'</span>  <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'search'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'pages'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'categories'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'archives'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
&nbsp;
	<span style="color: #0000ff;">'secondary_widget_area'</span>  <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'links'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'meta'</span> <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'activated'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
	update_option<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'sidebars_widgets'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$preset_widgets</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">// update_option( 'sidebars_widgets', NULL );</span></pre></td></tr></table></div>

<p>现在，在我们的 Primary Widget 区域 (<code>primary_widget_area</code>)，会自动显示搜索、静态页面、分类目录以及日志存档这四个小工具。而在  Secondary Widget 区域 (<code>secondary_widget_area</code>) 将会显示链接和元这两个小工具。只要激活 WordPress 主题，这些小工具就会自动显示。</p>
<p>看见最后一行 “ <code>// update_option( 'sidebars_widgets', NULL );</code> ” 了吗？如果您想重启小工具的话，就把前面的两斜杠去掉（并替代前面那一行？）。我想您能猜到 “NULL” 表示没有小工具。 </p>
<p>其次，我们将创建一个新的条件以便检测已有的小工具区域是否有小工具，这对我们以后写侧边栏代码很有帮助（谢谢 <a href="http://blog.kaizeku.com/">Chaos Kaizer</a>)。</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2747code9'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p27479"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code" id="p2747code9"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Check for static widgets in widget-ready areas</span>
<span style="color: #000000; font-weight: bold;">function</span> is_sidebar_active<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$index</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wp_registered_sidebars</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
  <span style="color: #000088;">$widgetcolums</span> <span style="color: #339933;">=</span> wp_get_sidebars_widgets<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$widgetcolums</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$index</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
	<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// end is_sidebar_active</span></pre></td></tr></table></div>

<p>现在我们需要让这些自定义代码发生作用。</p>
<h2>编写侧边栏模板代码</h2>
<p>在已有的动态小工具区域和预设小工具的基础上，我们创建的侧边栏模板将是您见过的最简单的模板之一。但是要记住，我们同时也通过 is_sidebar_active() 的 IF 语句把侧边栏固定。</p>
<p>下面就是侧边栏模板的代码：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2747code10'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p274710"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code" id="p2747code10"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> is_sidebar_active<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'primary_widget_area'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
		<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;primary&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;widget-area&quot;</span><span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>ul <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;xoxo&quot;</span><span style="color: #339933;">&gt;</span>
				<span style="color: #000000; font-weight: bold;">&lt;?php</span> dynamic_sidebar<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'primary_widget_area'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
			<span style="color: #339933;">&lt;/</span>ul<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#primary .widget-area --&gt;
</span><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>		
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> is_sidebar_active<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'secondary_widget_area'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
		<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;secondary&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;widget-area&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
			<span style="color: #339933;">&lt;</span>ul <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;xoxo&quot;</span><span style="color: #339933;">&gt;</span>
				<span style="color: #000000; font-weight: bold;">&lt;?php</span> dynamic_sidebar<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'secondary_widget_area'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
			<span style="color: #339933;">&lt;/</span>ul<span style="color: #339933;">&gt;</span>
&nbsp;
		<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#secondary .widget-area --&gt;
</span><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>现在如果您进入 WordPress 后台的小工具页面，把任一小工具区域的小工具全部移除，那么这个条件语句就失效，侧边栏那个小工具区域就没有小工具了。</p>
<h2>如何创建 WordPress 主题</h2>
<p>这篇文章是<a href="http://www.essentialblog.cn/wordpress-themes-templates-tutorial/">如何创建 WordPress 主题教程系列</a>的其中一部分，该系列将会教您如何从零开始创建强大的 WordPress 主题。建议您从头开始阅读这个系列并自己动手编写一些漂亮的代码。</p>
<ol>
<li><a href="http://www.essentialblog.cn/wordpress-themes-templates-tutorial/">介绍</a>；</li>
<li><a href="http://www.essentialblog.cn/wordpress-theme-development-tools/">WordPress 主题开发工具</a>；</li>
<li><a href="http://www.essentialblog.cn/creating-wordpress-theme-html-structure-tutorial/">创建一个 HTML 结构</a>；</li>
<li><a href="http://www.essentialblog.cn/wordpress-theme-template-and-directory-structure/">模板和目录结构</a>；</li>
<li><a href="http://www.essentialblog.cn/wordpress-theme-header-template-tutorial/">Header 模板</a>；</li>
<li><a href="http://www.essentialblog.cn/wordpress-theme-index-template-tutorial/">Index 模板</a>；</li>
<li><a href="http://www.essentialblog.cn/wordpress-theme-single-post-post-attachment-404-templates-tutorial/">Single、Attachment 和 404 模板</a>；</li>
<li><a href="http://www.essentialblog.cn/wordpress-theme-comments-template-tutorial/">Comments 模板</a>；</li>
<li><a href="http://www.essentialblog.cn/wordpress-theme-search-page-template-tutorial/">Search 和 Page 模板</a></li>
<li><a href="http://www.essentialblog.cn/archive-author-category-tags-template/">Archive、Author、Category 和 Tag 模板</a>；</li>
<li>Sidebar 模板；</li>
<li>复位重建主题的CSS和定义主题布局 (待译）</li>
</ol>
<p align="left">-------------------------------------</p><br />
 <p align="left">&copy; 逛逛<a href="http://www.essentialblog.cn/">精品博客</a>，看看博客精品。| 转载请遵循“<a href="http://creativecommons.org/licenses/by-nc/2.5/cn/">署名-非商业性使用</a>”的创作共用协议。</p><br />
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/e-blog?a=8-DciNcf8mM:zFY_DaXEwIM:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/e-blog?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/e-blog?a=8-DciNcf8mM:zFY_DaXEwIM:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/e-blog?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/e-blog?a=8-DciNcf8mM:zFY_DaXEwIM:R_Hd-r7sPaA"><img src="http://feeds.feedburner.com/~ff/e-blog?d=R_Hd-r7sPaA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/e-blog/~4/8-DciNcf8mM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.essentialblog.cn/wordpress-theme-sidebar-template/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.essentialblog.cn/wordpress-theme-sidebar-template/</feedburner:origLink></item>
		<item>
		<title>WordPress 主题之存档、作者、分类和标签模板</title>
		<link>http://feedproxy.google.com/~r/e-blog/~3/at0TeEMLvNk/</link>
		<comments>http://www.essentialblog.cn/archive-author-category-tags-template/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 04:48:59 +0000</pubDate>
		<dc:creator>Young</dc:creator>
				<category><![CDATA[博客技术]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[主题]]></category>
		<category><![CDATA[存档]]></category>
		<category><![CDATA[模板]]></category>

		<guid isPermaLink="false">http://www.essentialblog.cn/?p=2741</guid>
		<description><![CDATA[和 index.php 模板类似，我们要创建一个母模板，并通过它来创建其他子模板。这里的母模板是指存档模板。]]></description>
			<content:encoded><![CDATA[<p></p>
<p>原文：<a href="http://themeshaper.com/archive-author-category-tags-template/">The Archive, Author, Category &amp; Tags Template</a></p>
<p>原文作者：Ian Stewart</p>
<p>译文：<a href="http://www.essentialblog.cn/archive-author-category-tags-template/">WordPress 主题之存档、作者、分类和标签模板</a></p>
<p>译文作者：Young</p>
<p>和 index.php 模板类似，我们要创建一个母模板，并通过它来创建其他子模板。这里的母模板是指存档模板。</p>
<p>archive.php （以及它的相关模板）的作用是显示符合某些条件（例如某一段时间、某一个作者、某一个分类或者某一个标签等）的日志，和 index.php 很类似。如果能够理解这些模板的字面意思，您就知道这些模板是干什么用的了。 </p>
<p>让我们从之前的教程开始，下面是此文所有模板都要用到的相同的代码：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2741code11'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p274111"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code" id="p2741code11"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> get_header<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
		<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;container&quot;</span><span style="color: #339933;">&gt;</span>	
			<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;content&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
				<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nav-above&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;navigation&quot;</span><span style="color: #339933;">&gt;</span>
				<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#nav-above --&gt;
</span>
&nbsp;
				<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;post-&lt;?php the_ID(); ?&gt;&quot;</span> <span style="color: #000000; font-weight: bold;">&lt;?php</span> post_class<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&gt;</span>
				<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#post-&lt;?php the_ID(); </span><span style="color: #000000; font-weight: bold;">?&gt;</span> <span style="color: #339933;">--&gt;</span>			
&nbsp;
&nbsp;
				<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nav-below&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;navigation&quot;</span><span style="color: #339933;">&gt;</span>
				<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#nav-below --&gt;					
</span>
&nbsp;
			<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#content --&gt;		
</span>		<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#container --&gt;
</span>		
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> get_sidebar<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>	
<span style="color: #000000; font-weight: bold;">&lt;?php</span> get_footer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<h2>存档模板</h2>
<p>存档模板的功能如下：</p>
<ol>
<li>调用 the_post() 函数；</li>
<li>检测这个是什么模板；</li>
<li>生成一个合适的模板；</li>
<li>通过 rewind_post() 倒序排列文章； </li>
<li>执行 WordPress 循环功能。</li>
</ol>
<p>下面是 archive.php 模板的内容，注意顶部的<a href="http://codex.wordpress.org/Conditional_Tags">条件标签</a>是用来检测目前是什么模板的：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2741code12'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p274112"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
</pre></td><td class="code" id="p2741code12"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> the_post<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>			
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> is_day<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
				<span style="color: #339933;">&lt;</span>h1 <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;page-title&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Daily Archives: &lt;span&gt;%s&lt;/span&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> get_the_time<span style="color: #009900;">&#40;</span>get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'date_format'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>h1<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span> is_month<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
				<span style="color: #339933;">&lt;</span>h1 <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;page-title&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Monthly Archives: &lt;span&gt;%s&lt;/span&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> get_the_time<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'F Y'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>h1<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span> is_year<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
				<span style="color: #339933;">&lt;</span>h1 <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;page-title&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Yearly Archives: &lt;span&gt;%s&lt;/span&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> get_the_time<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>h1<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'paged'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'paged'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
				<span style="color: #339933;">&lt;</span>h1 <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;page-title&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php _e<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Blog Archives'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>h1<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> rewind_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">;</span> <span style="color: #000088;">$total_pages</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">max_num_pages</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$total_pages</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
				<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nav-above&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;navigation&quot;</span><span style="color: #339933;">&gt;</span>
					<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nav-previous&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php next_posts_link<span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'&lt;span class=&quot;meta-nav&quot;&gt;&amp;laquo;&lt;/span&gt; Older posts'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
					<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nav-next&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php previous_posts_link<span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Newer posts &lt;span class=&quot;meta-nav&quot;&gt;&amp;raquo;&lt;/span&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
				<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#nav-above --&gt;
</span><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>			
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span> have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> the_post<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&nbsp;
				<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;post-&lt;?php the_ID(); ?&gt;&quot;</span> <span style="color: #000000; font-weight: bold;">&lt;?php</span> post_class<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&gt;</span>
					<span style="color: #339933;">&lt;</span>h2 <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;entry-title&quot;</span><span style="color: #339933;">&gt;&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php the_permalink(); ?&gt;&quot;</span> title<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php printf( __('Permalink to <span style="color: #009933; font-weight: bold;">%s</span>', 'your-theme'), the_title_attribute('echo=0') ); ?&gt;&quot;</span> rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;bookmark&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;&lt;/</span>h2<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
					<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;entry-meta&quot;</span><span style="color: #339933;">&gt;</span>
						<span style="color: #339933;">&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;meta-prep meta-prep-author&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'By '</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span>
&nbsp;
						<span style="color: #339933;">&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;author vcard&quot;</span><span style="color: #339933;">&gt;&lt;</span>a <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;url fn n&quot;</span> href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php echo get_author_link( false, <span style="color: #006699; font-weight: bold;">$authordata-&gt;ID</span>, <span style="color: #006699; font-weight: bold;">$authordata-&gt;user_nicename</span> ); ?&gt;&quot;</span> title<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php printf( __( 'View all posts by <span style="color: #009933; font-weight: bold;">%s</span>', 'your-theme' ), <span style="color: #006699; font-weight: bold;">$authordata-&gt;display_name</span> ); ?&gt;&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php the_author<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;&lt;/</span>span<span style="color: #339933;">&gt;</span>
&nbsp;
						<span style="color: #339933;">&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;meta-sep&quot;</span><span style="color: #339933;">&gt;</span> <span style="color: #339933;">|</span> <span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span>
						<span style="color: #339933;">&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;meta-prep meta-prep-entry-date&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Published '</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span>
&nbsp;
						<span style="color: #339933;">&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;entry-date&quot;</span><span style="color: #339933;">&gt;&lt;</span>abbr <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;published&quot;</span> title<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php the_time('Y-m-d<span style="color: #000099; font-weight: bold;">\T</span>H:i:sO') ?&gt;&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php the_time<span style="color: #009900;">&#40;</span> get_option<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'date_format'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>abbr<span style="color: #339933;">&gt;&lt;/</span>span<span style="color: #339933;">&gt;</span>
&nbsp;
						<span style="color: #000000; font-weight: bold;">&lt;?php</span> edit_post_link<span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Edit'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&lt;span class=<span style="color: #000099; font-weight: bold;">\&quot;</span>meta-sep<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;|&lt;/span&gt;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span>&lt;span class=<span style="color: #000099; font-weight: bold;">\&quot;</span>edit-link<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&lt;/span&gt;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span>&quot;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
					<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #339933;">.</span>entry<span style="color: #339933;">-</span>meta <span style="color: #339933;">--&gt;</span>
&nbsp;
					<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;entry-summary&quot;</span><span style="color: #339933;">&gt;</span>	
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_excerpt<span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Continue reading &lt;span class=&quot;meta-nav&quot;&gt;&amp;raquo;&lt;/span&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span>  <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
					<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #339933;">.</span>entry<span style="color: #339933;">-</span>summary <span style="color: #339933;">--&gt;</span>
&nbsp;
					<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;entry-utility&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
						<span style="color: #339933;">&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;cat-links&quot;</span><span style="color: #339933;">&gt;&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;entry-utility-prep entry-utility-prep-cat-links&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php _e<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Posted in '</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php <span style="color: #b1b100;">echo</span> get_the_category_list<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">', '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span>
&nbsp;
						<span style="color: #339933;">&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;meta-sep&quot;</span><span style="color: #339933;">&gt;</span> <span style="color: #339933;">|</span> <span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span>
						<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_tags<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'&lt;span class=&quot;tag-links&quot;&gt;&lt;span class=&quot;entry-utility-prep entry-utility-prep-tag-links&quot;&gt;'</span> <span style="color: #339933;">.</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Tagged '</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/span&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;, &quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&lt;/span&gt;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span>&lt;span class=<span style="color: #000099; font-weight: bold;">\&quot;</span>meta-sep<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;|&lt;/span&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
						<span style="color: #339933;">&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;comments-link&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php comments_popup_link<span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Leave a comment'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'1 Comment'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'% Comments'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span>
&nbsp;
						<span style="color: #000000; font-weight: bold;">&lt;?php</span> edit_post_link<span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Edit'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&lt;span class=<span style="color: #000099; font-weight: bold;">\&quot;</span>meta-sep<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;|&lt;/span&gt;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span>&lt;span class=<span style="color: #000099; font-weight: bold;">\&quot;</span>edit-link<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&lt;/span&gt;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
					<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#entry-utility --&gt;	
</span>				<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#post-&lt;?php the_ID(); </span><span style="color: #000000; font-weight: bold;">?&gt;</span> <span style="color: #339933;">--&gt;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>			
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">;</span> <span style="color: #000088;">$total_pages</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">max_num_pages</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$total_pages</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
				<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nav-below&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;navigation&quot;</span><span style="color: #339933;">&gt;</span>
					<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nav-previous&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php next_posts_link<span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'&lt;span class=&quot;meta-nav&quot;&gt;&amp;laquo;&lt;/span&gt; Older posts'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
					<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nav-next&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php previous_posts_link<span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Newer posts &lt;span class=&quot;meta-nav&quot;&gt;&amp;raquo;&lt;/span&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
				<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#nav-below --&gt;
</span><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<h2>作者模板</h2>
<p>作者模板不需要改多少内容，您会喜欢这个模板的。复制 archive.php 并重命名为 author.php，然后我们所需要做的是把页面标题部分的代码替换成下面这个：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2741code13'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p274113"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p2741code13"><pre class="php" style="font-family:monospace;">&nbsp;
				<span style="color: #339933;">&lt;</span>h1 <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;page-title author&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Author Archives: &lt;span class=&quot;vcard&quot;&gt;%s&lt;/span&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&lt;a class='url fn n' href='<span style="color: #006699; font-weight: bold;">$authordata-&gt;user_url</span>' title='<span style="color: #006699; font-weight: bold;">$authordata-&gt;display_name</span>' rel='me'&gt;<span style="color: #006699; font-weight: bold;">$authordata-&gt;display_name</span>&lt;/a&gt;&quot;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>h1<span style="color: #339933;">&gt;</span>
&nbsp;
				<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000088;">$authordesc</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$authordata</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">user_description</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$authordesc</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">echo</span> apply_filters<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'archive_meta'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;div class=&quot;archive-meta&quot;&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$authordesc</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/div&gt;'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>很简单，对吧？</p>
<h2>分类模板</h2>
<p>分类模板也是一个简单的模板，复制 archive.php 的所有内容并重命名为 category.php。 </p>
<p>现在打开 functions.php。我们要添加一个自定义的功能——来自优秀的 Sandbox 主题——以便使我们的分类模板更加有用。</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2741code14'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p274114"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td><td class="code" id="p2741code14"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #666666; font-style: italic;">// For category lists on category archives: Returns other categories except the current one (redundant)</span>
<span style="color: #000000; font-weight: bold;">function</span> cats_meow<span style="color: #009900;">&#40;</span><span style="color: #000088;">$glue</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$current_cat</span> <span style="color: #339933;">=</span> single_cat_title<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$separator</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$cats</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$separator</span><span style="color: #339933;">,</span> get_the_category_list<span style="color: #009900;">&#40;</span><span style="color: #000088;">$separator</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$cats</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$str</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">strstr</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$str</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&gt;<span style="color: #006699; font-weight: bold;">$current_cat</span>&lt;&quot;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
			<span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cats</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cats</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
&nbsp;
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">join</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$glue</span><span style="color: #339933;">,</span> <span style="color: #000088;">$cats</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// end cats_meow</span></pre></td></tr></table></div>

<p>cats_meow() 函数把目前的分类从分类页面删除，换句话说，它删掉日志摘要下多余的分类目录。</p>
<p>现在，回到 category.php 文件，用以下代码替代页面标题部分：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2741code15'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p274115"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p2741code15"><pre class="php" style="font-family:monospace;">&nbsp;
				<span style="color: #339933;">&lt;</span>h1 <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;page-title&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php _e<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Category Archives:'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> <span style="color: #339933;">&lt;</span>span<span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php single_cat_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;&lt;/</span>span<span style="color: #339933;">&gt;&lt;/</span>h1<span style="color: #339933;">&gt;</span>
&nbsp;
				<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000088;">$categorydesc</span> <span style="color: #339933;">=</span> category_description<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$categorydesc</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">echo</span> apply_filters<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'archive_meta'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;div class=&quot;archive-meta&quot;&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$categorydesc</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/div&gt;'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>在 .entry-utility div 标签里找到以下代码：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2741code16'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p274116"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2741code16"><pre class="php" style="font-family:monospace;">&nbsp;
						<span style="color: #339933;">&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;cat-links&quot;</span><span style="color: #339933;">&gt;&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;entry-utility-prep entry-utility-prep-cat-links&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php _e<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Posted in '</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php <span style="color: #b1b100;">echo</span> get_the_category_list<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">', '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;meta-sep&quot;</span><span style="color: #339933;">&gt;</span> <span style="color: #339933;">|</span> <span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span>原文少了最后一个 <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">.</span><span style="color: #009900;">&#41;</span></pre></td></tr></table></div>

<p>然后把上面的代码替换成下面这个：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2741code17'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p274117"><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code" id="p2741code17"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$cats_meow</span> <span style="color: #339933;">=</span> cats_meow<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">', '</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #666666; font-style: italic;">// Returns categories other than the one queried ?&gt;</span>
&nbsp;
						<span style="color: #339933;">&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;cat-links&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Also posted in %s'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$cats_meow</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span>
&nbsp;
						<span style="color: #339933;">&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;meta-sep&quot;</span><span style="color: #339933;">&gt;</span> <span style="color: #339933;">|</span> <span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<h2>标签模板</h2>
<p>标签模板和分类模板几乎一样，只是它是按照标签来归类的。方法是复制 archive.php 文件然后重命名为 tag.php。</p>
<p>同样，我们也需要在 functions.php 文件里面添加一个 tag_ur_it() 函数 —— 也是来自 Sandbox 主题。功能就像 cats_meow() 那样，不过它是删除多余的标签，代码如下：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2741code18'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p274118"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
</pre></td><td class="code" id="p2741code18"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #666666; font-style: italic;">// For tag lists on tag archives: Returns other tags except the current one (redundant)</span>
<span style="color: #000000; font-weight: bold;">function</span> tag_ur_it<span style="color: #009900;">&#40;</span><span style="color: #000088;">$glue</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$current_tag</span> <span style="color: #339933;">=</span> single_tag_title<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span>  <span style="color: #009900; font-weight: bold;">false</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$separator</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$tags</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$separator</span><span style="color: #339933;">,</span> get_the_tag_list<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$separator</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&quot;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$tags</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$str</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">strstr</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$str</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&gt;<span style="color: #006699; font-weight: bold;">$current_tag</span>&lt;&quot;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
			<span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tags</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tags</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
&nbsp;
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">join</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$glue</span><span style="color: #339933;">,</span> <span style="color: #000088;">$tags</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// end tag_ur_it</span></pre></td></tr></table></div>

<p>现在，打开 tag.php 文件，并用以下代码替代页面标题代码：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2741code19'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p274119"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2741code19"><pre class="php" style="font-family:monospace;">&nbsp;
				<span style="color: #339933;">&lt;</span>h1 <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;page-title&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php _e<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Tag Archives:'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> <span style="color: #339933;">&lt;</span>span<span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php single_tag_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;&lt;/</span>h1<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>然后在 .entry-utility 标签里找到以下代码：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2741code20'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p274120"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2741code20"><pre class="php" style="font-family:monospace;">&nbsp;
						<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_tags<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'&lt;span class=&quot;tag-links&quot;&gt;&lt;span class=&quot;entry-utility-prep entry-utility-prep-tag-links&quot;&gt;'</span> <span style="color: #339933;">.</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Tagged '</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/span&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;, &quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&lt;/span&gt;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span>&lt;span class=<span style="color: #000099; font-weight: bold;">\&quot;</span>meta-sep<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;|&lt;/span&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>把上面的代码替换成下面这个：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2741code21'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p274121"><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="p2741code21"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$tag_ur_it</span> <span style="color: #339933;">=</span> tag_ur_it<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">', '</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #666666; font-style: italic;">// Returns tags other than the one queried ?&gt;						</span>
&nbsp;
						<span style="color: #339933;">&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;tag-links&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Also tagged %s'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$tag_ur_it</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>这样一来，标签模板就做好了。</p>
<h2>如何创建 WordPress 主题</h2>
<p>这篇文章是<a href="http://www.essentialblog.cn/wordpress-themes-templates-tutorial/">如何创建 WordPress 主题教程系列</a>的其中一部分，该系列将会教您如何从零开始创建强大的 WordPress 主题。建议您从头开始阅读这个系列并自己动手编写一些漂亮的代码。</p>
<p align="left">-------------------------------------</p><br />
 <p align="left">&copy; 逛逛<a href="http://www.essentialblog.cn/">精品博客</a>，看看博客精品。| 转载请遵循“<a href="http://creativecommons.org/licenses/by-nc/2.5/cn/">署名-非商业性使用</a>”的创作共用协议。</p><br />
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/e-blog?a=at0TeEMLvNk:vjE9n8w8w_c:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/e-blog?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/e-blog?a=at0TeEMLvNk:vjE9n8w8w_c:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/e-blog?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/e-blog?a=at0TeEMLvNk:vjE9n8w8w_c:R_Hd-r7sPaA"><img src="http://feeds.feedburner.com/~ff/e-blog?d=R_Hd-r7sPaA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/e-blog/~4/at0TeEMLvNk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.essentialblog.cn/archive-author-category-tags-template/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.essentialblog.cn/archive-author-category-tags-template/</feedburner:origLink></item>
		<item>
		<title>WordPress 主题之搜索模板和静态页面模板</title>
		<link>http://feedproxy.google.com/~r/e-blog/~3/nPgvpC7tT5I/</link>
		<comments>http://www.essentialblog.cn/wordpress-theme-search-page-template-tutorial/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 02:37:46 +0000</pubDate>
		<dc:creator>Young</dc:creator>
				<category><![CDATA[博客技术]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[主题]]></category>
		<category><![CDATA[搜索]]></category>
		<category><![CDATA[模板]]></category>
		<category><![CDATA[静态页面]]></category>

		<guid isPermaLink="false">http://www.essentialblog.cn/?p=2737</guid>
		<description><![CDATA[对任一完整的 WordPress 主题来说，搜索模板和静态页面模板都是很重要的，并且代码都很容易。这两个模板也是模板中的模板，都有以下相同的代码：]]></description>
			<content:encoded><![CDATA[<p></p>
<p>原文：<a href="http://themeshaper.com/wordpress-theme-search-page-template-tutorial/">The WordPress Theme Search Template and Page Template</a></p>
<p>原文作者：Ian Stewart</p>
<p>译文: <a href="http://www.essentialblog.cn/wordpress-theme-search-page-template-tutorial/">WordPress 主题之搜索模板和静态页面模板</a></p>
<p>译文作者：Young</p>
<p>对任一完整的 WordPress 主题来说，搜索模板和静态页面模板都是很重要的，并且代码都很容易。这两个模板也是模板中的模板，都有以下相同的代码：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2737code22'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p273722"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
</pre></td><td class="code" id="p2737code22"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> get_header<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&nbsp;
		<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;container&quot;</span><span style="color: #339933;">&gt;</span>	
			<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;content&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
				<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nav-above&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;navigation&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
				<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#nav-above --&gt;
</span>
				<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;post-&lt;?php the_ID(); ?&gt;&quot;</span> <span style="color: #000000; font-weight: bold;">&lt;?php</span> post_class<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&gt;</span>
&nbsp;
				<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#post-&lt;?php the_ID(); </span><span style="color: #000000; font-weight: bold;">?&gt;</span> <span style="color: #339933;">--&gt;</span>			
&nbsp;
				<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nav-below&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;navigation&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
				<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#nav-below --&gt;					
</span>
&nbsp;
			<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#content --&gt;		
</span>		<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#container --&gt;
</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> get_sidebar<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>	
<span style="color: #000000; font-weight: bold;">&lt;?php</span> get_footer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>当然，每个模板也都互不相同。</p>
<h2>搜索模板</h2>
<p>在 serach.php 里面，我们需要重新用到循环。这次使用 IF 语句 —— 以防循环里没有任何文章。</p>
<p>工作原理是这样的：如果有文章，或者说有符合搜索条件的文章，那么就循环检测，就像 index.php 里面的循环语句一样。但是如果没有文章，或者没有符合搜索条件的文章，那就为搜索者提供另外一个搜索机会。</p>
<p>代码如下：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2737code23'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p273723"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
</pre></td><td class="code" id="p2737code23"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> get_header<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
		<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;container&quot;</span><span style="color: #339933;">&gt;</span>	
			<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;content&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>				
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span> have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> the_post<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;!--</span> this is our loop <span style="color: #339933;">--&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">else</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&nbsp;
<span style="color: #339933;">&lt;!--</span> here<span style="color: #0000ff;">'s where we'</span>ll put a search form <span style="color: #b1b100;">if</span> there<span style="color: #0000ff;">'re no posts --&gt;
&nbsp;
&lt;?php endif; ?&gt;			
&nbsp;
			&lt;/div&gt;&lt;!-- #content --&gt;		
		&lt;/div&gt;&lt;!-- #container --&gt;
&nbsp;
&nbsp;
&lt;?php get_sidebar(); ?&gt;	
&lt;?php get_footer(); ?&gt;</span></pre></td></tr></table></div>

<p>非常直接了当，是吧？</p>
<p>我想保留日志标题、元、内容（或摘要）以及实用链接等 index 模板里面有的内容不变，但是 WordPress 搜索日志的时候同时也会搜索静态页面，而静态页面是不需要元或者实用链接之类的，所以，在我们的循环里面，将会检测看是搜索日志还是搜索静态页面。</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2737code24'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p273724"><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code" id="p2737code24"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_type</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'post'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>这个 IF 语句只有搜索静态页面的时候才会显示，现在我们知道会发生什么事了，以下就是搜索模板 #content DIV 标签里面的代码：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2737code25'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p273725"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
</pre></td><td class="code" id="p2737code25"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&nbsp;
				<span style="color: #339933;">&lt;</span>h1 <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;page-title&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php _e<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Search Results for: '</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;</span>span<span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php the_search_query<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;&lt;/</span>h1<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">;</span> <span style="color: #000088;">$total_pages</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">max_num_pages</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$total_pages</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
				<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nav-above&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;navigation&quot;</span><span style="color: #339933;">&gt;</span>
					<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nav-previous&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php next_posts_link<span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'&lt;span class=&quot;meta-nav&quot;&gt;&amp;laquo;&lt;/span&gt; Older posts'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
					<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nav-next&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php previous_posts_link<span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Newer posts &lt;span class=&quot;meta-nav&quot;&gt;&amp;raquo;&lt;/span&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
				<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#nav-above --&gt;
</span><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>							
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span> have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> the_post<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&nbsp;
				<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;post-&lt;?php the_ID(); ?&gt;&quot;</span> <span style="color: #000000; font-weight: bold;">&lt;?php</span> post_class<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&gt;</span>
					<span style="color: #339933;">&lt;</span>h2 <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;entry-title&quot;</span><span style="color: #339933;">&gt;&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php the_permalink(); ?&gt;&quot;</span> title<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php printf( __('Permalink to <span style="color: #009933; font-weight: bold;">%s</span>', 'your-theme'), the_title_attribute('echo=0') ); ?&gt;&quot;</span> rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;bookmark&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;&lt;/</span>h2<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_type</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'post'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>									
					<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;entry-meta&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
						<span style="color: #339933;">&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;meta-prep meta-prep-author&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'By '</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span>
&nbsp;
						<span style="color: #339933;">&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;author vcard&quot;</span><span style="color: #339933;">&gt;&lt;</span>a <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;url fn n&quot;</span> href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php echo get_author_link( false, <span style="color: #006699; font-weight: bold;">$authordata-&gt;ID</span>, <span style="color: #006699; font-weight: bold;">$authordata-&gt;user_nicename</span> ); ?&gt;&quot;</span> title<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php printf( __( 'View all posts by <span style="color: #009933; font-weight: bold;">%s</span>', 'your-theme' ), <span style="color: #006699; font-weight: bold;">$authordata-&gt;display_name</span> ); ?&gt;&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php the_author<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;&lt;/</span>span<span style="color: #339933;">&gt;</span>
&nbsp;
						<span style="color: #339933;">&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;meta-sep&quot;</span><span style="color: #339933;">&gt;</span> <span style="color: #339933;">|</span> <span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span>
						<span style="color: #339933;">&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;meta-prep meta-prep-entry-date&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Published '</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span>
&nbsp;
						<span style="color: #339933;">&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;entry-date&quot;</span><span style="color: #339933;">&gt;&lt;</span>abbr <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;published&quot;</span> title<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php the_time('Y-m-d<span style="color: #000099; font-weight: bold;">\T</span>H:i:sO') ?&gt;&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php the_time<span style="color: #009900;">&#40;</span> get_option<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'date_format'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>abbr<span style="color: #339933;">&gt;&lt;/</span>span<span style="color: #339933;">&gt;</span>
&nbsp;
						<span style="color: #000000; font-weight: bold;">&lt;?php</span> edit_post_link<span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Edit'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&lt;span class=<span style="color: #000099; font-weight: bold;">\&quot;</span>meta-sep<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;|&lt;/span&gt;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span>&lt;span class=<span style="color: #000099; font-weight: bold;">\&quot;</span>edit-link<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&lt;/span&gt;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span>&quot;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
					<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #339933;">.</span>entry<span style="color: #339933;">-</span>meta <span style="color: #339933;">--&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&nbsp;
					<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;entry-summary&quot;</span><span style="color: #339933;">&gt;</span>	
<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_excerpt<span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Continue reading &lt;span class=&quot;meta-nav&quot;&gt;&amp;raquo;&lt;/span&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span>  <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_link_pages<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'before=&lt;div class=&quot;page-link&quot;&gt;'</span> <span style="color: #339933;">.</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Pages:'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&amp;after=&lt;/div&gt;'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
					<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #339933;">.</span>entry<span style="color: #339933;">-</span>summary <span style="color: #339933;">--&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_type</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'post'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>									
					<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;entry-utility&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
						<span style="color: #339933;">&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;cat-links&quot;</span><span style="color: #339933;">&gt;&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;entry-utility-prep entry-utility-prep-cat-links&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php _e<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Posted in '</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php <span style="color: #b1b100;">echo</span> get_the_category_list<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">', '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span>
&nbsp;
						<span style="color: #339933;">&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;meta-sep&quot;</span><span style="color: #339933;">&gt;</span> <span style="color: #339933;">|</span> <span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span>
						<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_tags<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'&lt;span class=&quot;tag-links&quot;&gt;&lt;span class=&quot;entry-utility-prep entry-utility-prep-tag-links&quot;&gt;'</span> <span style="color: #339933;">.</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Tagged '</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/span&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;, &quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&lt;/span&gt;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span>&lt;span class=<span style="color: #000099; font-weight: bold;">\&quot;</span>meta-sep<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;|&lt;/span&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
						<span style="color: #339933;">&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;comments-link&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php comments_popup_link<span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Leave a comment'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'1 Comment'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'% Comments'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span>
&nbsp;
						<span style="color: #000000; font-weight: bold;">&lt;?php</span> edit_post_link<span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Edit'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&lt;span class=<span style="color: #000099; font-weight: bold;">\&quot;</span>meta-sep<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;|&lt;/span&gt;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span>&lt;span class=<span style="color: #000099; font-weight: bold;">\&quot;</span>edit-link<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&lt;/span&gt;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
					<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#entry-utility --&gt;	
</span><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>					
				<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#post-&lt;?php the_ID(); </span><span style="color: #000000; font-weight: bold;">?&gt;</span> <span style="color: #339933;">--&gt;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">;</span> <span style="color: #000088;">$total_pages</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">max_num_pages</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$total_pages</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
				<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nav-below&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;navigation&quot;</span><span style="color: #339933;">&gt;</span>
					<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nav-previous&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php next_posts_link<span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'&lt;span class=&quot;meta-nav&quot;&gt;&amp;laquo;&lt;/span&gt; Older posts'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
					<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nav-next&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php previous_posts_link<span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Newer posts &lt;span class=&quot;meta-nav&quot;&gt;&amp;raquo;&lt;/span&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
				<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#nav-below --&gt;
</span><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>			
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">else</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&nbsp;
				<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;post-0&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;post no-results not-found&quot;</span><span style="color: #339933;">&gt;</span>
					<span style="color: #339933;">&lt;</span>h2 <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;entry-title&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php _e<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Nothing Found'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>h2<span style="color: #339933;">&gt;</span>
&nbsp;
					<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;entry-content&quot;</span><span style="color: #339933;">&gt;</span>
						<span style="color: #339933;">&lt;</span>p<span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php _e<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Sorry, but nothing matched your search criteria. Please try again with some different keywords.'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>p<span style="color: #339933;">&gt;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">&lt;?php</span> get_search_form<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>						
					<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #339933;">.</span>entry<span style="color: #339933;">-</span>content <span style="color: #339933;">--&gt;</span>
&nbsp;
				<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>【当然，您还可以加上页眉和页脚以及侧边栏等函数。——译者注】</p>
<h2>静态页面模板</h2>
<p>您知道静态页面模板是干什么用的。WordPress 认为它是一种没有时间顺序的日志。我们认为它是一个静态页面，不过日志的所有装饰它都几乎没有——除了评论，有些静态页面是有评论的。我不喜欢，不过您可能喜欢。如果您想在静态页面添加评论，可以在静态页面上添加带有 Name 和 Value 的 “comments”自定义区域，这个我听起来不错。 </p>
<p>下面就是静态页面代码：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2737code26'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p273726"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
</pre></td><td class="code" id="p2737code26"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> get_header<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&nbsp;
		<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;container&quot;</span><span style="color: #339933;">&gt;</span>	
			<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;content&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_post<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&nbsp;
				<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;post-&lt;?php the_ID(); ?&gt;&quot;</span> <span style="color: #000000; font-weight: bold;">&lt;?php</span> post_class<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&gt;</span>
					<span style="color: #339933;">&lt;</span>h1 <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;entry-title&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>h1<span style="color: #339933;">&gt;</span>
&nbsp;
					<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;entry-content&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_content<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_link_pages<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'before=&lt;div class=&quot;page-link&quot;&gt;'</span> <span style="color: #339933;">.</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Pages:'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&amp;after=&lt;/div&gt;'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>					
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> edit_post_link<span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Edit'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;span class=&quot;edit-link&quot;&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;/span&gt;'</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
					<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #339933;">.</span>entry<span style="color: #339933;">-</span>content <span style="color: #339933;">--&gt;</span>
				<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#post-&lt;?php the_ID(); </span><span style="color: #000000; font-weight: bold;">?&gt;</span> <span style="color: #339933;">--&gt;</span>			
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> get_post_custom_values<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'comments'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> comments_template<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">// Add a custom field with Name and Value of &quot;comments&quot; to enable comments on this page ?&gt;			</span>
&nbsp;
&nbsp;
			<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#content --&gt;		
</span>		<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#container --&gt;
</span>		
<span style="color: #000000; font-weight: bold;">&lt;?php</span> get_sidebar<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>	
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> get_footer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<h2>如何创建 WordPress 主题</h2>
<p>这篇文章是<a href="http://www.essentialblog.cn/wordpress-themes-templates-tutorial/">如何创建 WordPress 主题教程系列</a>的其中一部分，该系列将会教您如何从零开始创建强大的 WordPress 主题。建议您从头开始阅读这个系列并自己动手编写一些漂亮的代码。</p>
<p align="left">-------------------------------------</p><br />
 <p align="left">&copy; 逛逛<a href="http://www.essentialblog.cn/">精品博客</a>，看看博客精品。| 转载请遵循“<a href="http://creativecommons.org/licenses/by-nc/2.5/cn/">署名-非商业性使用</a>”的创作共用协议。</p><br />
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/e-blog?a=nPgvpC7tT5I:0W5mpm8V1D4:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/e-blog?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/e-blog?a=nPgvpC7tT5I:0W5mpm8V1D4:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/e-blog?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/e-blog?a=nPgvpC7tT5I:0W5mpm8V1D4:R_Hd-r7sPaA"><img src="http://feeds.feedburner.com/~ff/e-blog?d=R_Hd-r7sPaA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/e-blog/~4/nPgvpC7tT5I" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.essentialblog.cn/wordpress-theme-search-page-template-tutorial/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.essentialblog.cn/wordpress-theme-search-page-template-tutorial/</feedburner:origLink></item>
		<item>
		<title>WordPress 主题之评论模板</title>
		<link>http://feedproxy.google.com/~r/e-blog/~3/_mwAqvFafjQ/</link>
		<comments>http://www.essentialblog.cn/wordpress-theme-comments-template-tutorial/#comments</comments>
		<pubDate>Sun, 05 Jul 2009 02:02:12 +0000</pubDate>
		<dc:creator>Young</dc:creator>
				<category><![CDATA[博客技术]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[主题]]></category>
		<category><![CDATA[模板]]></category>
		<category><![CDATA[评论]]></category>

		<guid isPermaLink="false">http://www.essentialblog.cn/?p=2717</guid>
		<description><![CDATA[是的，我讨厌评论模板，因为它可能相当令人困惑。在 2.7 版本上，WordPress 介绍了一个简单的创建评论模板的方法，但是那种方法不能使留言和引用分开，也不能自定义评论结构，并且仍然令人困惑。]]></description>
			<content:encoded><![CDATA[<p></p>
<p><em>原文：<a href="http://themeshaper.com/wordpress-theme-comments-template-tutorial/">The WordPress Theme Comments Template</a></em></p>
<p><em>原文作者：Ian Stewart</em></p>
<p><em>译文：<a href="http://www.essentialblog.cn/wordpress-theme-comments-template-tutorial/">WordPress 主题之评论模板</a></em></p>
<p><em>译文作者：Young</em></p>
<p>是的，我讨厌评论模板，因为它可能相当令人困惑。在 2.7 版本上，WordPress 介绍了一个简单的创建评论模板的方法，但是那种方法不能使留言和引用分开，也不能自定义评论结构，并且仍然令人困惑。</p>
<p>您很幸运，我把问题解决了，虽然还是有点令人困惑，但毕竟解决了问题。在这个评论模板的教程上，我将基本上介绍每一步会发生什么，展示您那些自定义代码，以及需要添加到 function.php 的代码，最后给出整个模板代码。希望这对您有帮助。但是至少您将会有一个漂亮的评论模板。 </p>
<p>让我们简要的看一下这个评论模板会发生什么事：</p>
<ol>
<li>阻止机器人抓取评论内容以及受密码保护的文章；</li>
<li>检查是否有评论；</li>
<li>计算留言和引用 （trackbacks or&nbsp;pings） 的数量；</li>
<li>如果有评论，显示评论，并链接到评论；</li>
<li>如果有引用，显示引用；</li>
<li>如果评论被启用，显示评论“回复”框。</li>
</ol>
<p>这个模板的代码很多，但是总结起来也就这几个功能，直截了当。</p>
<h2>自定义回调留言和引用</h2>
<p>WordPress 2.7 允许通过 wp_list_comments() 函数方便有序地调用单独日志的留言和引用。如果您喜欢那样，那就很方便。但是我们不喜欢，我想要把评论里面的留言和引用分开。</p>
<p>为了实现这种结果，您需要对留言和引用进行自定义回调，把下面代码插入到 functions.php 文件：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2717code27'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p271727"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
</pre></td><td class="code" id="p2717code27"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Custom callback to list comments in the your-theme style</span>
<span style="color: #000000; font-weight: bold;">function</span> custom_comments<span style="color: #009900;">&#40;</span><span style="color: #000088;">$comment</span><span style="color: #339933;">,</span> <span style="color: #000088;">$args</span><span style="color: #339933;">,</span> <span style="color: #000088;">$depth</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'comment'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$comment</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'comment_depth'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$depth</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">?&gt;</span>
  	<span style="color: #339933;">&lt;</span>li id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;comment-&lt;?php comment_ID() ?&gt;&quot;</span> <span style="color: #000000; font-weight: bold;">&lt;?php</span> comment_class<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&gt;</span>
  		<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;comment-author vcard&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php commenter_link<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
  		<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;comment-meta&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Posted %1$s at %2$s &lt;span class=&quot;meta-sep&quot;&gt;|&lt;/span&gt; &lt;a href=&quot;%3$s&quot; title=&quot;Permalink to this comment&quot;&gt;Permalink&lt;/a&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
&nbsp;
  					get_comment_date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
  					get_comment_time<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
  					<span style="color: #0000ff;">'#comment-'</span> <span style="color: #339933;">.</span> get_comment_ID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  					edit_comment_link<span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Edit'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">' &lt;span class=&quot;meta-sep&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;edit-link&quot;&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;/span&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$comment</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">comment_approved</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'0'</span><span style="color: #009900;">&#41;</span> _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span>&lt;span class='unapproved'&gt;Your comment is awaiting moderation.&lt;/span&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
          <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;comment-content&quot;</span><span style="color: #339933;">&gt;</span>
      		<span style="color: #000000; font-weight: bold;">&lt;?php</span> comment_text<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
  		<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// echo the comment reply link</span>
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$args</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'type'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'all'</span> <span style="color: #339933;">||</span> get_comment_type<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'comment'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span>
&nbsp;
				comment_reply_link<span style="color: #009900;">&#40;</span><span style="color: #990000;">array_merge</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$args</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
					<span style="color: #0000ff;">'reply_text'</span> <span style="color: #339933;">=&gt;</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Reply'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'your-theme'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> 
					<span style="color: #0000ff;">'login_text'</span> <span style="color: #339933;">=&gt;</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Log in to reply.'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'your-theme'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
&nbsp;
					<span style="color: #0000ff;">'depth'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$depth</span><span style="color: #339933;">,</span>
					<span style="color: #0000ff;">'before'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;div class=&quot;comment-reply-link&quot;&gt;'</span><span style="color: #339933;">,</span> 
					<span style="color: #0000ff;">'after'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;/div&gt;'</span>
&nbsp;
				<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// end custom_comments</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2717code28'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p271728"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code" id="p2717code28"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Custom callback to list pings</span>
<span style="color: #000000; font-weight: bold;">function</span> custom_pings<span style="color: #009900;">&#40;</span><span style="color: #000088;">$comment</span><span style="color: #339933;">,</span> <span style="color: #000088;">$args</span><span style="color: #339933;">,</span> <span style="color: #000088;">$depth</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
       <span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'comment'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$comment</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">?&gt;</span>
    		<span style="color: #339933;">&lt;</span>li id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;comment-&lt;?php comment_ID() ?&gt;&quot;</span> <span style="color: #000000; font-weight: bold;">&lt;?php</span> comment_class<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&gt;</span>
    			<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;comment-author&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'By %1$s on %2$s at %3$s'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
&nbsp;
    					get_comment_author_link<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    					get_comment_date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    					get_comment_time<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    					edit_comment_link<span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Edit'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">' &lt;span class=&quot;meta-sep&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;edit-link&quot;&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;/span&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$comment</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">comment_approved</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'0'</span><span style="color: #009900;">&#41;</span> _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'\t\t\t\t\t&lt;span class=&quot;unapproved&quot;&gt;Your trackback is awaiting moderation.&lt;/span&gt;\n'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
            <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;comment-content&quot;</span><span style="color: #339933;">&gt;</span>
    			<span style="color: #000000; font-weight: bold;">&lt;?php</span> comment_text<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
			<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// end custom_pings</span></pre></td></tr></table></div>

<p>这些代码看起来有点乱，是吧？但它们是最好的。现在到创建评论结构了，我想下面那个结构很漂亮，并且能够让您只通过 CSS 就能更改很多 —— 如果您真的想修改这个结构。</p>
<p>我们还需要调用一个特殊的自定义函数，这个函数将会显示符合 microformat hcard 架构的头像结构。</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2717code29'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p271729"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code" id="p2717code29"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Produces an avatar image with the hCard-compliant photo class</span>
<span style="color: #000000; font-weight: bold;">function</span> commenter_link<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$commenter</span> <span style="color: #339933;">=</span> get_comment_author_link<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">ereg</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'&lt;a[^&gt;]* class=[^&gt;]+&gt;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$commenter</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #000088;">$commenter</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ereg_replace</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'(&lt;a[^&gt;]* class=[\'&quot;]?)'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'\\1url '</span> <span style="color: #339933;">,</span> <span style="color: #000088;">$commenter</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$commenter</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ereg_replace</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'(&lt;a )/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'\\1class=&quot;url &quot;'</span> <span style="color: #339933;">,</span> <span style="color: #000088;">$commenter</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000088;">$avatar_email</span> <span style="color: #339933;">=</span> get_comment_author_email<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$avatar</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;class='avatar&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;class='photo avatar&quot;</span><span style="color: #339933;">,</span> get_avatar<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$avatar_email</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">80</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$avatar</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' &lt;span class=&quot;fn n&quot;&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$commenter</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/span&gt;'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// end commenter_link</span></pre></td></tr></table></div>

<p>（以上代码插入于 functions.php 文件中。——译者注）</p>
<p>如果想改变头像的尺寸，您只需要改一下 get_avatar($avatar_email, 80) 里面的 80 就可以了，80 表示头像的大小，单位是像素。</p>
<h2>评论模板</h2>
<p>没有把您吓跑吧？诚然，并不是很可怕。下面是整个评论模板代码，上面有些 PHP 注释，以便您的理解。</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2717code30'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p271730"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
</pre></td><td class="code" id="p2717code30"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">/* The Comments Template — with, er, comments! */</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>			
			<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;comments&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">/* Run some checks for bots and password protected posts */</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>	
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
	<span style="color: #000088;">$req</span> <span style="color: #339933;">=</span> get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'require_name_email'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Checks if fields are required.</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'comments.php'</span> <span style="color: #339933;">==</span> <span style="color: #990000;">basename</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'SCRIPT_FILENAME'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
&nbsp;
		<span style="color: #990000;">die</span> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Please do not load this page directly. Thanks!'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_password</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span>
&nbsp;
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_COOKIE</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'wp-postpass_'</span> <span style="color: #339933;">.</span> COOKIEHASH<span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_password</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span>
				<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nopassword&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'This post is password protected. Enter the password to view any comments.'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
			<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #339933;">.</span>comments <span style="color: #339933;">--&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
		<span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">/* See IF there are comments and do the comments stuff! */</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>						
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> have_comments<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">/* Count the number of comments and trackbacks (or pings) */</span>
<span style="color: #000088;">$ping_count</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$comment_count</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$comments</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$comment</span> <span style="color: #009900;">&#41;</span>
&nbsp;
	get_comment_type<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;comment&quot;</span> ? <span style="color: #339933;">++</span><span style="color: #000088;">$comment_count</span> <span style="color: #339933;">:</span> <span style="color: #339933;">++</span><span style="color: #000088;">$ping_count</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">/* IF there are comments, show the comments */</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$comments_by_type</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'comment'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&nbsp;
				<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;comments-list&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;comments&quot;</span><span style="color: #339933;">&gt;</span>
					<span style="color: #339933;">&lt;</span>h3<span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$comment_count</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">1</span> ? __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;span&gt;%d&lt;/span&gt; Comments'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;span&gt;One&lt;/span&gt; Comment'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$comment_count</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>h3<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">/* If there are enough comments, build the comment navigation  */</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>					
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000088;">$total_pages</span> <span style="color: #339933;">=</span> get_comment_pages_count<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$total_pages</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
					<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;comments-nav-above&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;comments-navigation&quot;</span><span style="color: #339933;">&gt;</span>
								<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;paginated-comments-links&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php paginate_comments_links<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
					<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#comments-nav-above --&gt;					
</span><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>					
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">/* An ordered list of our custom comments callback, custom_comments(), in functions.php   */</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>				
					<span style="color: #339933;">&lt;</span>ol<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_list_comments<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'type=comment&amp;callback=custom_comments'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
					<span style="color: #339933;">&lt;/</span>ol<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">/* If there are enough comments, build the comment navigation */</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000088;">$total_pages</span> <span style="color: #339933;">=</span> get_comment_pages_count<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$total_pages</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>					
	  			<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;comments-nav-below&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;comments-navigation&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
						<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;paginated-comments-links&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php paginate_comments_links<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
	        <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#comments-nav-below --&gt;
</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>					
&nbsp;
				<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#comments-list .comments --&gt;
</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">/* if ( $comment_count ) */</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">/* If there are trackbacks(pings), show the trackbacks  */</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$comments_by_type</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'pings'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&nbsp;
				<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;trackbacks-list&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;comments&quot;</span><span style="color: #339933;">&gt;</span>
					<span style="color: #339933;">&lt;</span>h3<span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ping_count</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">1</span> ? __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;span&gt;%d&lt;/span&gt; Trackbacks'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;span&gt;One&lt;/span&gt; Trackback'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$ping_count</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>h3<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">/* An ordered list of our custom trackbacks callback, custom_pings(), in functions.php   */</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>					
					<span style="color: #339933;">&lt;</span>ol<span style="color: #339933;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_list_comments<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'type=pings&amp;callback=custom_pings'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
					<span style="color: #339933;">&lt;/</span>ol<span style="color: #339933;">&gt;</span>				
&nbsp;
				<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#trackbacks-list .comments --&gt;			
</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span> <span style="color: #666666; font-style: italic;">/* if ( $ping_count ) */</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span> <span style="color: #666666; font-style: italic;">/* if ( $comments ) */</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">/* If comments are open, build the respond form */</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'open'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">comment_status</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
				<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;respond&quot;</span><span style="color: #339933;">&gt;</span>
    				<span style="color: #339933;">&lt;</span>h3<span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php comment_form_title<span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Post a Comment'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Post a Reply to %s'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>h3<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
    				<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;cancel-comment-reply&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php cancel_comment_reply_link<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'comment_registration'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #000088;">$user_ID</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
					<span style="color: #339933;">&lt;</span>p id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;login-req&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'You must be &lt;a href=&quot;%s&quot; title=&quot;Log in&quot;&gt;logged in&lt;/a&gt; to post a comment.'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
&nbsp;
					get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'siteurl'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/wp-login.php?redirect_to='</span> <span style="color: #339933;">.</span> get_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>p<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">else</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
					<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;formcontainer&quot;</span><span style="color: #339933;">&gt;</span>	
&nbsp;
&nbsp;
&nbsp;
						<span style="color: #339933;">&lt;</span>form id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;commentform&quot;</span> action<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php echo get_option('siteurl'); ?&gt;/wp-comments-post.php&quot;</span> method<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;post&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$user_ID</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
							<span style="color: #339933;">&lt;</span>p id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;login&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;span class=&quot;loggedin&quot;&gt;Logged in as &lt;a href=&quot;%1$s&quot; title=&quot;Logged in as %2$s&quot;&gt;%2$s&lt;/a&gt;.&lt;/span&gt; &lt;span class=&quot;logout&quot;&gt;&lt;a href=&quot;%3$s&quot; title=&quot;Log out of this account&quot;&gt;Log out?&lt;/a&gt;&lt;/span&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
&nbsp;
								get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'siteurl'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/wp-admin/profile.php'</span><span style="color: #339933;">,</span>
								wp_specialchars<span style="color: #009900;">&#40;</span><span style="color: #000088;">$user_identity</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
&nbsp;
								wp_logout_url<span style="color: #009900;">&#40;</span>get_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>p<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">else</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&nbsp;
							<span style="color: #339933;">&lt;</span>p id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;comment-notes&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Your email is &lt;em&gt;never&lt;/em&gt; published nor shared.'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$req</span><span style="color: #009900;">&#41;</span> _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Required fields are marked &lt;span class=&quot;required&quot;&gt;*&lt;/span&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>p<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
              <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;form-section-author&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;form-section&quot;</span><span style="color: #339933;">&gt;</span>
								<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;form-label&quot;</span><span style="color: #339933;">&gt;&lt;</span>label <span style="color: #b1b100;">for</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;author&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Name'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>label<span style="color: #339933;">&gt;</span> <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$req</span><span style="color: #009900;">&#41;</span> _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;span class=&quot;required&quot;&gt;*&lt;/span&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
								<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;form-input&quot;</span><span style="color: #339933;">&gt;&lt;</span>input id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;author&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;author&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php echo <span style="color: #006699; font-weight: bold;">$comment_author</span> ?&gt;&quot;</span> size<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;30&quot;</span> maxlength<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;20&quot;</span> tabindex<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;3&quot;</span> <span style="color: #339933;">/&gt;&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
              <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#form-section-author .form-section --&gt;
</span>
              <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;form-section-email&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;form-section&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
								<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;form-label&quot;</span><span style="color: #339933;">&gt;&lt;</span>label <span style="color: #b1b100;">for</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;email&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Email'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>label<span style="color: #339933;">&gt;</span> <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$req</span><span style="color: #009900;">&#41;</span> _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;span class=&quot;required&quot;&gt;*&lt;/span&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
								<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;form-input&quot;</span><span style="color: #339933;">&gt;&lt;</span>input id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;email&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;email&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php echo <span style="color: #006699; font-weight: bold;">$comment_author_email</span> ?&gt;&quot;</span> size<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;30&quot;</span> maxlength<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;50&quot;</span> tabindex<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;4&quot;</span> <span style="color: #339933;">/&gt;&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
              <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#form-section-email .form-section --&gt;
</span>
              <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;form-section-url&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;form-section&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
								<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;form-label&quot;</span><span style="color: #339933;">&gt;&lt;</span>label <span style="color: #b1b100;">for</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;url&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Website'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>label<span style="color: #339933;">&gt;&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
								<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;form-input&quot;</span><span style="color: #339933;">&gt;&lt;</span>input id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;url&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;url&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php echo <span style="color: #006699; font-weight: bold;">$comment_author_url</span> ?&gt;&quot;</span> size<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;30&quot;</span> maxlength<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;50&quot;</span> tabindex<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;5&quot;</span> <span style="color: #339933;">/&gt;&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
              <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#form-section-url .form-section --&gt;
</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span> <span style="color: #666666; font-style: italic;">/* if ( $user_ID ) */</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&nbsp;
              <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;form-section-comment&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;form-section&quot;</span><span style="color: #339933;">&gt;</span>
								<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;form-label&quot;</span><span style="color: #339933;">&gt;&lt;</span>label <span style="color: #b1b100;">for</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;comment&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Comment'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>label<span style="color: #339933;">&gt;&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
								<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;form-textarea&quot;</span><span style="color: #339933;">&gt;&lt;</span>textarea id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;comment&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;comment&quot;</span> cols<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;45&quot;</span> rows<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;8&quot;</span> tabindex<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;6&quot;</span><span style="color: #339933;">&gt;&lt;/</span>textarea<span style="color: #339933;">&gt;&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
              <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#form-section-comment .form-section --&gt;
</span>              
              <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;form-allowed-tags&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;form-section&quot;</span><span style="color: #339933;">&gt;</span>
	              <span style="color: #339933;">&lt;</span>p<span style="color: #339933;">&gt;&lt;</span>span<span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'You may use these &lt;abbr title=&quot;HyperText Markup Language&quot;&gt;HTML&lt;/abbr&gt; tags and attributes:'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span> <span style="color: #339933;">&lt;</span>code<span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php <span style="color: #b1b100;">echo</span> allowed_tags<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>code<span style="color: #339933;">&gt;&lt;/</span>p<span style="color: #339933;">&gt;</span>
&nbsp;
              <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> do_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'comment_form'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&nbsp;
							<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;form-submit&quot;</span><span style="color: #339933;">&gt;&lt;</span>input id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;submit&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;submit&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;submit&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php _e('Post Comment', 'your-theme') ?&gt;&quot;</span> tabindex<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;7&quot;</span> <span style="color: #339933;">/&gt;&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;hidden&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;comment_post_ID&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php echo <span style="color: #006699; font-weight: bold;">$id</span>; ?&gt;&quot;</span> <span style="color: #339933;">/&gt;&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> comment_id_fields<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>  
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">/* Just … end everything. We're done here. Close it up. */</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>  
&nbsp;
						<span style="color: #339933;">&lt;/</span>form<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#commentform --&gt;										
</span>
					<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #339933;">.</span>formcontainer <span style="color: #339933;">--&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span> <span style="color: #666666; font-style: italic;">/* if ( get_option('comment_registration') &amp;&amp; !$user_ID ) */</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
				<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#respond --&gt;
</span><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span> <span style="color: #666666; font-style: italic;">/* if ( 'open' == $post-&gt;comment_status ) */</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
			<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#comments --&gt;</span></pre></td></tr></table></div>

<p>就这么多了，您已经创建了一个自定义的漂亮的评论模板。</p>
<h2>如何创建 WordPress 主题</h2>
<p>这篇文章是<a href="http://www.essentialblog.cn/wordpress-themes-templates-tutorial/">如何创建 WordPress 主题教程系列</a>的其中一部分，该系列将会教您如何从零开始创建强大的 WordPress 主题。建议您从头开始阅读这个系列并自己动手编写一些漂亮的代码。</p>
<p align="left">-------------------------------------</p><br />
 <p align="left">&copy; 逛逛<a href="http://www.essentialblog.cn/">精品博客</a>，看看博客精品。| 转载请遵循“<a href="http://creativecommons.org/licenses/by-nc/2.5/cn/">署名-非商业性使用</a>”的创作共用协议。</p><br />
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/e-blog?a=_mwAqvFafjQ:Hr2PHb4XHFc:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/e-blog?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/e-blog?a=_mwAqvFafjQ:Hr2PHb4XHFc:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/e-blog?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/e-blog?a=_mwAqvFafjQ:Hr2PHb4XHFc:R_Hd-r7sPaA"><img src="http://feeds.feedburner.com/~ff/e-blog?d=R_Hd-r7sPaA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/e-blog/~4/_mwAqvFafjQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.essentialblog.cn/wordpress-theme-comments-template-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.essentialblog.cn/wordpress-theme-comments-template-tutorial/</feedburner:origLink></item>
		<item>
		<title>WordPress 主题之单独日志、附档和 404 模板</title>
		<link>http://feedproxy.google.com/~r/e-blog/~3/2qFnpJ_OSzA/</link>
		<comments>http://www.essentialblog.cn/wordpress-theme-single-post-post-attachment-404-templates-tutorial/#comments</comments>
		<pubDate>Sat, 04 Jul 2009 06:02:05 +0000</pubDate>
		<dc:creator>Young</dc:creator>
				<category><![CDATA[博客技术]]></category>
		<category><![CDATA[404]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[单独日志]]></category>
		<category><![CDATA[模板]]></category>

		<guid isPermaLink="false">http://www.essentialblog.cn/?p=2716</guid>
		<description><![CDATA[single.php （以及以后将要创建的几乎所有的其他模板）的结构很多都是和 index.php 一样的，事实上，您可以把它看成模板中的模板。]]></description>
			<content:encoded><![CDATA[<p></p>
<p><em>原文：<a href="http://themeshaper.com/wordpress-theme-single-post-post-attachment-404-templates-tutorial/">The WordPress Theme Single Post, Post Attachment, &amp; 404 Templates</a></em></p>
<p><em>原文作者：Ian Stewart</em></p>
<p><em>译文：<a href="http://www.essentialblog.cn//wordpress-theme-single-post-post-attachment-404-templates-tutorial/">WordPress 主题之单独日志、附档和 404 模板</a></em></p>
<p><em>译文作者：Young</em></p>
<p>您已经为所有的文件创建了一个 Index，现在您需要为每一篇单独的文章（或者缺失的内容）创建一个单独的模板。 </p>
<h2>模板中的模板</h2>
<p>single.php （以及以后将要创建的几乎所有的其他模板）的结构很多都是和 index.php 一样的，事实上，您可以把它看成模板中的模板。相同结构如下：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2716code31'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p271631"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code" id="p2716code31"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> get_header<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&nbsp;
		<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;container&quot;</span><span style="color: #339933;">&gt;</span>	
			<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;content&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
				<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nav-above&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;navigation&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
				<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#nav-above --&gt;
</span>
				<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;post-&lt;?php the_ID(); ?&gt;&quot;</span> <span style="color: #000000; font-weight: bold;">&lt;?php</span> post_class<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&gt;</span>
&nbsp;
				<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#post-&lt;?php the_ID(); </span><span style="color: #000000; font-weight: bold;">?&gt;</span> <span style="color: #339933;">--&gt;</span>			
				<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nav-below&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;navigation&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
				<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#nav-below --&gt;					
</span>
&nbsp;
			<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#content --&gt;		
</span>		<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#container --&gt;
</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> get_sidebar<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>	
<span style="color: #000000; font-weight: bold;">&lt;?php</span> get_footer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>但是也会有些显著的不同，先从 the_post() 和 comments_template() 开始吧。</p>
<p>在 &lt;div id=&quot;content&quot;&gt; 之后以及 &lt;div id=&quot;nav-above&quot; class=&quot;navigation&quot;&gt; 之前，我们将调用 the_post() 函数（即 &lt;?php the_post(); ?&gt;）。这个模板不需要循环，因为通过之前创建的 the_permalink() 函数， WordPress 知道我们要找什么。</p>
<p>既然这是一篇单独日志，我们需要调用 comments_template() 函数。因为我们要把留言和引用分开，所以代码该是这样：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2716code32'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p271632"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2716code32"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> comments_template<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>上面的代码需要放在 &lt;/div&gt;&lt;!&#8211; #content &#8211;&gt; 之前，&lt;/div&gt;&lt;!&#8211; #nav-below &#8211;&gt; 之后。</p>
<h2>单独日志导航</h2>
<p>这里，我们将会用 next_post_link() 替代 previous_posts_link(), 用 previous_post_link() 替代 next_posts_link()，他们的作用就和他们的名称一样。 </p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2716code33'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p271633"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code" id="p2716code33"><pre class="php" style="font-family:monospace;">	<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nav-above&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;navigation&quot;</span><span style="color: #339933;">&gt;</span>
					<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nav-previous&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php previous_post_link<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'%link'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;span class=&quot;meta-nav&quot;&gt;&amp;laquo;&lt;/span&gt; %title'</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
					<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nav-next&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php next_post_link<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'%link'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'%title &lt;span class=&quot;meta-nav&quot;&gt;&amp;raquo;&lt;/span&gt;'</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
				<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#nav-above --&gt;
</span>
				<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nav-below&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;navigation&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
					<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nav-previous&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php previous_post_link<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'%link'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;span class=&quot;meta-nav&quot;&gt;&amp;laquo;&lt;/span&gt; %title'</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
					<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nav-next&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php next_post_link<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'%link'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'%title &lt;span class=&quot;meta-nav&quot;&gt;&amp;raquo;&lt;/span&gt;'</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
				<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#nav-below --&gt;</span></pre></td></tr></table></div>

<h2>单独日志标题</h2>
<p>如果您还记得 <a href="http://www.essentialblog.cn/wordpress-theme-header-template-tutorial/">header.php </a>那一课，就会发现我们用一个动态的 IF 语句方便屏幕浏览器识别单独日志标题。在这里以及后面的主题模板，我们将用 H1 标签获取文章标题。</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2716code34'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p271634"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2716code34"><pre class="php" style="font-family:monospace;">	<span style="color: #339933;">&lt;</span>h1 <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;entry-title&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>h1<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>[代码放于 &lt;div id=&quot;post-&lt;?php the_id()? &gt;&quot; &lt;?php post_class(); ?&gt;&gt; ] 之后。——译者注]</p>
<p>您会发现这个代码也有点简单，不需要任何链接。</p>
<h2>单独日志实用性链接</h2>
<p>文章的实用性很复杂。您从中将会发觉一次性获得答案以及站在他人肩膀上的好处。</p>
<p>在看代码之前，我们应该想一下它为什么那么复杂。由于 WordPress 评论的特殊性，我们需要考虑几种不同的方式：同时开放留言和引用方式、只开放引用、只开放留言或者留言和引用都关闭。这就意味着要用上一大堆 IF 语句，当然，还有 ELSEIF 语句。</p>
<p>我们还想添加一个页面永久链接以及 RSS 链接，这对跟踪开发交流有用。</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2716code35'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p271635"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
</pre></td><td class="code" id="p2716code35"><pre class="php" style="font-family:monospace;">		<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;entry-utility&quot;</span><span style="color: #339933;">&gt;</span>
					<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'This entry was posted in %1$s%2$s. Bookmark the &lt;a href=&quot;%3$s&quot; title=&quot;Permalink to %4$s&quot; rel=&quot;bookmark&quot;&gt;permalink&lt;/a&gt;. Follow any comments here with the &lt;a href=&quot;%5$s&quot; title=&quot;Comments RSS to %4$s&quot; rel=&quot;alternate&quot; type=&quot;application/rss+xml&quot;&gt;RSS feed for this post&lt;/a&gt;.'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
&nbsp;
						get_the_category_list<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">', '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
						get_the_tag_list<span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">' and tagged '</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">', '</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
&nbsp;
						get_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
						the_title_attribute<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'echo=0'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
						comments_rss<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'open'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">comment_status</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'open'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ping_status</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #666666; font-style: italic;">// Comments and trackbacks open ?&gt;</span>
&nbsp;
						<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'&lt;a class=&quot;comment-link&quot; href=&quot;#respond&quot; title=&quot;Post a comment&quot;&gt;Post a comment&lt;/a&gt; or leave a trackback: &lt;a class=&quot;trackback-link&quot; href=&quot;%s&quot; title=&quot;Trackback URL for your post&quot; rel=&quot;trackback&quot;&gt;Trackback URL&lt;/a&gt;.'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> get_trackback_url<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'open'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">comment_status</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'open'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ping_status</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #666666; font-style: italic;">// Only trackbacks open ?&gt;</span>
&nbsp;
						<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Comments are closed, but you can leave a trackback: &lt;a class=&quot;trackback-link&quot; href=&quot;%s&quot; title=&quot;Trackback URL for your post&quot; rel=&quot;trackback&quot;&gt;Trackback URL&lt;/a&gt;.'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> get_trackback_url<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'open'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">comment_status</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'open'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ping_status</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #666666; font-style: italic;">// Only comments open ?&gt;</span>
&nbsp;
						<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Trackbacks are closed, but you can &lt;a class=&quot;comment-link&quot; href=&quot;#respond&quot; title=&quot;Post a comment&quot;&gt;post a comment&lt;/a&gt;.'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'open'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">comment_status</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'open'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ping_status</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #666666; font-style: italic;">// Comments and trackbacks closed ?&gt;</span>
&nbsp;
						<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Both comments and trackbacks are currently closed.'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> edit_post_link<span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Edit'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span>&lt;span class=<span style="color: #000099; font-weight: bold;">\&quot;</span>edit-link<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&lt;/span&gt;&quot;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
					<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #339933;">.</span>entry<span style="color: #339933;">-</span>utility <span style="color: #339933;">--&gt;</span></pre></td></tr></table></div>

<p>上面的代码并没有那么复杂，不是吗？</p>
<h2>单独日志内容</h2>
<p>和 index.php 不一样，single.php 的内容很简单，只需要调用一个简单的 wp_link_page() 函数。</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2716code36'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p271636"><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code" id="p2716code36"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> the_content<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_link_pages<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'before=&lt;div class=&quot;page-link&quot;&gt;'</span> <span style="color: #339933;">.</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Pages:'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&amp;after=&lt;/div&gt;'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>(以上代码要放于 class=&quot;entry-content&quot; 的 DIV 标签中间。——译者注） </p>
<h2>单独日志附档</h2>
<p>并没有多少人使用文章附档模板，但是它很有趣。当您在文章里添加图片的时候，您实际上是把图片附在文章上面。当然，您不仅可以附加图片。我们将要创建一个 attachment.php 文件，但是如果您喜欢，也可以添加 video.php、audio.php 以及 application.php，那样就可以在文章上面附视频、音频和其他应用了。创建附档模板的方法有很多种。</p>
<p>其中最简单的方法是复制 single.php 文件里面的内容，并重命名为 attachment.php，然后稍作修改：</p>
<p>首先，删除顶部的导航代码，这里完全不需要它，然后用链接到原始文章的的页面标题代替。 </p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2716code37'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p271637"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2716code37"><pre class="php" style="font-family:monospace;">	<span style="color: #339933;">&lt;</span>h1 <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;page-title&quot;</span><span style="color: #339933;">&gt;&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php echo get_permalink(<span style="color: #006699; font-weight: bold;">$post-&gt;post_parent</span>) ?&gt;&quot;</span> title<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php printf( __( 'Return to <span style="color: #009933; font-weight: bold;">%s</span>', 'your-theme' ), wp_specialchars( get_the_title(<span style="color: #006699; font-weight: bold;">$post-&gt;post_parent</span>), 1 ) ) ?&gt;&quot;</span> rev<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;attachment&quot;</span><span style="color: #339933;">&gt;&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;meta-nav&quot;</span><span style="color: #339933;">&gt;&amp;</span>laquo<span style="color: #339933;">;</span> <span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php <span style="color: #b1b100;">echo</span> get_the_title<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_parent</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;&lt;/</span>h1<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>既然页面标题已经由 h1 标签调用，我们的文章标题应该使用 h2 标签。</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2716code38'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p271638"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2716code38"><pre class="php" style="font-family:monospace;">	<span style="color: #339933;">&lt;</span>h2 <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;entry-title&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>h2<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>由于很多的附档都是图片，为了正确显示附档，我们需要调用一个 IF 语句：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2716code39'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p271639"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td><td class="code" id="p2716code39"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;entry-content&quot;</span><span style="color: #339933;">&gt;</span>
						<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;entry-attachment&quot;</span><span style="color: #339933;">&gt;</span>					
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> wp_attachment_is_image<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$att_image</span> <span style="color: #339933;">=</span> wp_get_attachment_image_src<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;medium&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
						<span style="color: #339933;">&lt;</span>p <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;attachment&quot;</span><span style="color: #339933;">&gt;&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php echo wp_get_attachment_url(<span style="color: #006699; font-weight: bold;">$post-&gt;id</span>); ?&gt;&quot;</span> title<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php the_title(); ?&gt;&quot;</span> rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;attachment&quot;</span><span style="color: #339933;">&gt;&lt;</span>img src<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php echo <span style="color: #006699; font-weight: bold;">$att_image[0]</span>;?&gt;&quot;</span> width<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php echo <span style="color: #006699; font-weight: bold;">$att_image[1]</span>;?&gt;&quot;</span> height<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php echo <span style="color: #006699; font-weight: bold;">$att_image[2]</span>;?&gt;&quot;</span>  <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;attachment-medium&quot;</span> alt<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php <span style="color: #006699; font-weight: bold;">$post-&gt;post_excerpt</span>; ?&gt;&quot;</span> <span style="color: #339933;">/&gt;&lt;/</span>a<span style="color: #339933;">&gt;</span>
&nbsp;
						<span style="color: #339933;">&lt;/</span>p<span style="color: #339933;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">else</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>		
						<span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php echo wp_get_attachment_url(<span style="color: #006699; font-weight: bold;">$post-&gt;ID</span>) ?&gt;&quot;</span> title<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php echo wp_specialchars( get_the_title(<span style="color: #006699; font-weight: bold;">$post-&gt;ID</span>), 1 ) ?&gt;&quot;</span> rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;attachment&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php <span style="color: #b1b100;">echo</span> <span style="color: #990000;">basename</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">guid</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span>		
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>		
						<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>				
						<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;entry-caption&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_excerpt</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> the_excerpt<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_content<span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Continue reading &lt;span class=&quot;meta-nav&quot;&gt;&amp;raquo;&lt;/span&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span>  <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_link_pages<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'before=&lt;div class=&quot;page-link&quot;&gt;'</span> <span style="color: #339933;">.</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Pages:'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&amp;after=&lt;/div&gt;'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&nbsp;
					<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #339933;">.</span>entry<span style="color: #339933;">-</span>content <span style="color: #339933;">--&gt;</span></pre></td></tr></table></div>

<p>再删除底部的导航代码之后，attachment.php 模板就做好了。</p>
<h2>404&nbsp;模板</h2>
<p>当访问页面不存在的时候（例如博客文章的 URL 输入错误，或者文章根本就没有发表），就会出现 404 错误。</p>
<p>我们可以创建一个空白的 404.php 文件，然后插入以下代码：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2716code40'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p271640"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code" id="p2716code40"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;post-0&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;post error404 not-found&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
					<span style="color: #339933;">&lt;</span>h1 <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;entry-title&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php _e<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Not Found'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>h1<span style="color: #339933;">&gt;</span>
&nbsp;
					<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;entry-content&quot;</span><span style="color: #339933;">&gt;</span>
						<span style="color: #339933;">&lt;</span>p<span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php _e<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Apologies, but we were unable to find what you were looking for. Perhaps searching will help.'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>p<span style="color: #339933;">&gt;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">&lt;?php</span> get_search_form<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
					<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #339933;">.</span>entry<span style="color: #339933;">-</span>content <span style="color: #339933;">--&gt;</span>
&nbsp;
				<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#post-0 --&gt;</span></pre></td></tr></table></div>

<p>这样，当访问页面不存在的时候，就会出现一个对不起的提示以及一个搜索框，非常简单直接。</pre>
<h2>如何创建 WordPress 主题</h2>
<p>这篇文章是<a href="http://www.essentialblog.cn/wordpress-themes-templates-tutorial/">如何创建 WordPress 主题教程系列</a>的其中一部分，该系列将会教您如何从零开始创建强大的 WordPress 主题。建议您从头开始阅读这个系列并自己动手编写一些漂亮的代码。</p>
<p><strong>译者注：</strong></p>
<p>1、single.php 文件里面作者好像忘记了元标签，虽然这个也可以从 index.php 里面复制过来。</p>
<p>2、single.php 文件里面的全部代码如下：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2716code41'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p271641"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
</pre></td><td class="code" id="p2716code41"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> get_header<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;container&quot;</span><span style="color: #339933;">&gt;</span>	
			<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;content&quot;</span><span style="color: #339933;">&gt;</span>
			<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_post<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
			<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nav-above&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;navigation&quot;</span><span style="color: #339933;">&gt;</span>
					<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nav-previous&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php previous_post_link<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'%link'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;span class=&quot;meta-nav&quot;&gt;&amp;laquo;&lt;/span&gt; %title'</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
					<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nav-next&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php next_post_link<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'%link'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'%title &lt;span class=&quot;meta-nav&quot;&gt;&amp;raquo;&lt;/span&gt;'</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
			  <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#nav-above --&gt;
</span>
				<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;post-&lt;?php the_ID(); ?&gt;&quot;</span> <span style="color: #000000; font-weight: bold;">&lt;?php</span> post_class<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&gt;</span>
&nbsp;
						<span style="color: #339933;">&lt;</span>h1 <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;entry-title&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>h1<span style="color: #339933;">&gt;</span>
						<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;entry-meta&quot;</span><span style="color: #339933;">&gt;</span>
						<span style="color: #339933;">&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;meta-prep meta-prep-author&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'By '</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your_theme'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span>
&nbsp;
						<span style="color: #339933;">&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;author vcard&quot;</span><span style="color: #339933;">&gt;&lt;</span>a <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;url fn n&quot;</span> href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php echo get_author_link( false, <span style="color: #006699; font-weight: bold;">$authordata-&gt;ID</span>, <span style="color: #006699; font-weight: bold;">$authordata-&gt;user_nicename</span> ); ?&gt;&quot;</span> title<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php printf( __( 'View all posts by <span style="color: #009933; font-weight: bold;">%s</span>', 'your_theme' ), <span style="color: #006699; font-weight: bold;">$authordata-&gt;display_name</span> ); ?&gt;&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php the_author<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;&lt;/</span>span<span style="color: #339933;">&gt;</span>
&nbsp;
						<span style="color: #339933;">&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;meta-sep&quot;</span><span style="color: #339933;">&gt;</span> <span style="color: #339933;">|</span> <span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span>
						<span style="color: #339933;">&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;meta-prep meta-prep-entry-date&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Published '</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your_theme'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span>
&nbsp;
						<span style="color: #339933;">&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;entry-date&quot;</span><span style="color: #339933;">&gt;&lt;</span>abbr <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;published&quot;</span> title<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php the_time('Y-m-d<span style="color: #000099; font-weight: bold;">\T</span>H:i:sO') ?&gt;&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php the_time<span style="color: #009900;">&#40;</span> get_option<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'date_format'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>abbr<span style="color: #339933;">&gt;&lt;/</span>span<span style="color: #339933;">&gt;</span>
&nbsp;
						<span style="color: #000000; font-weight: bold;">&lt;?php</span> edit_post_link<span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Edit'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your_theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&lt;span class=<span style="color: #000099; font-weight: bold;">\&quot;</span>meta-sep<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;|&lt;/span&gt;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span>&lt;span class=<span style="color: #000099; font-weight: bold;">\&quot;</span>edit-link<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&lt;/span&gt;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span>&quot;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>						
					<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #339933;">.</span>entry<span style="color: #339933;">-</span>meta <span style="color: #339933;">--&gt;</span>
&nbsp;
											<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;entry-content&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_content<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_link_pages<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'before=&lt;div class=&quot;page-link&quot;&gt;'</span> <span style="color: #339933;">.</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Pages:'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your_theme'</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&amp;after=&lt;/div&gt;'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
					<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #339933;">.</span>entry<span style="color: #339933;">-</span>content <span style="color: #339933;">--&gt;</span>
&nbsp;
								<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;entry-utility&quot;</span><span style="color: #339933;">&gt;</span>
					<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'This entry was posted in %1$s%2$s. Bookmark the &lt;a href=&quot;%3$s&quot; title=&quot;Permalink to %4$s&quot; rel=&quot;bookmark&quot;&gt;permalink&lt;/a&gt;. Follow any comments here with the &lt;a href=&quot;%5$s&quot; title=&quot;Comments RSS to %4$s&quot; rel=&quot;alternate&quot; type=&quot;application/rss+xml&quot;&gt;RSS feed for this post&lt;/a&gt;.'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
&nbsp;
&nbsp;
						get_the_category_list<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">', '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
						get_the_tag_list<span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">' and tagged '</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">', '</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
&nbsp;
&nbsp;
						get_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
						the_title_attribute<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'echo=0'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
						comments_rss<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'open'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">comment_status</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'open'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ping_status</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #666666; font-style: italic;">// Comments and trackbacks open ?&gt;</span>
&nbsp;
&nbsp;
						<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'&lt;a class=&quot;comment-link&quot; href=&quot;#respond&quot; title=&quot;Post a comment&quot;&gt;Post a comment&lt;/a&gt; or leave a trackback: &lt;a class=&quot;trackback-link&quot; href=&quot;%s&quot; title=&quot;Trackback URL for your post&quot; rel=&quot;trackback&quot;&gt;Trackback URL&lt;/a&gt;.'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> get_trackback_url<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'open'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">comment_status</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'open'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ping_status</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #666666; font-style: italic;">// Only trackbacks open ?&gt;</span>
&nbsp;
&nbsp;
						<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Comments are closed, but you can leave a trackback: &lt;a class=&quot;trackback-link&quot; href=&quot;%s&quot; title=&quot;Trackback URL for your post&quot; rel=&quot;trackback&quot;&gt;Trackback URL&lt;/a&gt;.'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> get_trackback_url<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'open'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">comment_status</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'open'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ping_status</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #666666; font-style: italic;">// Only comments open ?&gt;</span>
&nbsp;
&nbsp;
						<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Trackbacks are closed, but you can &lt;a class=&quot;comment-link&quot; href=&quot;#respond&quot; title=&quot;Post a comment&quot;&gt;post a comment&lt;/a&gt;.'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'open'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">comment_status</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'open'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ping_status</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #666666; font-style: italic;">// Comments and trackbacks closed ?&gt;</span>
&nbsp;
&nbsp;
						<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Both comments and trackbacks are currently closed.'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> edit_post_link<span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Edit'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'your-theme'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span>&lt;span class=<span style="color: #000099; font-weight: bold;">\&quot;</span>edit-link<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&lt;/span&gt;&quot;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&nbsp;
					<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
								<span style="color: #339933;">&lt;!--</span> <span style="color: #339933;">.</span>entry<span style="color: #339933;">-</span>utility <span style="color: #339933;">--&gt;</span>
&nbsp;
				<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#post-&lt;?php the_ID(); </span><span style="color: #000000; font-weight: bold;">?&gt;</span> <span style="color: #339933;">--&gt;</span>			
		<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nav-below&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;navigation&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
					<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nav-previous&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php previous_post_link<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'%link'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;span class=&quot;meta-nav&quot;&gt;&amp;laquo;&lt;/span&gt; %title'</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
					<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nav-next&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php next_post_link<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'%link'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'%title &lt;span class=&quot;meta-nav&quot;&gt;&amp;raquo;&lt;/span&gt;'</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
				<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;!--</span> <span style="color: #666666; font-style: italic;">#nav-below --&gt;				
</span><span style="color: #000000; font-weight: bold;">&lt;?php</span> comments_template<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;!--</span> <span style="color: #666666; font-style: italic;">#content --&gt;		
</span><span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #666666; font-style: italic;">#container --&gt;
</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> get_sidebar<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>	
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> get_footer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p align="left">-------------------------------------</p><br />
 <p align="left">&copy; 逛逛<a href="http://www.essentialblog.cn/">精品博客</a>，看看博客精品。| 转载请遵循“<a href="http://creativecommons.org/licenses/by-nc/2.5/cn/">署名-非商业性使用</a>”的创作共用协议。</p><br />
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/e-blog?a=2qFnpJ_OSzA:n0ARHfXVGoE:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/e-blog?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/e-blog?a=2qFnpJ_OSzA:n0ARHfXVGoE:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/e-blog?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/e-blog?a=2qFnpJ_OSzA:n0ARHfXVGoE:R_Hd-r7sPaA"><img src="http://feeds.feedburner.com/~ff/e-blog?d=R_Hd-r7sPaA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/e-blog/~4/2qFnpJ_OSzA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.essentialblog.cn/wordpress-theme-single-post-post-attachment-404-templates-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.essentialblog.cn/wordpress-theme-single-post-post-attachment-404-templates-tutorial/</feedburner:origLink></item>
		<item>
		<title>QQ 肥水不流外人田</title>
		<link>http://feedproxy.google.com/~r/e-blog/~3/CyTNt9F1a_Y/</link>
		<comments>http://www.essentialblog.cn/qq-is-too-selfish-to-accept-palringo/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 23:00:05 +0000</pubDate>
		<dc:creator>Young</dc:creator>
				<category><![CDATA[博客评论]]></category>
		<category><![CDATA[Palringo]]></category>
		<category><![CDATA[QQ]]></category>

		<guid isPermaLink="false">http://www.essentialblog.cn/?p=2714</guid>
		<description><![CDATA[为什么除了 QQ，MSN、GTalk、Facebook 等其他的 IM 工具都没有问题呢？难道是他们的帐户安全都不如 QQ？对此我深表怀疑。我认为 QQ 不给 Palringo 整合的根本原因不是为了帐号的安全，而是为了避免“肥水流外人田”。]]></description>
			<content:encoded><![CDATA[<p></p>
<p>在 《<a href="http://www.essentialblog.cn/qq-in-palringo/">您的 QQ 号码可能存在异常情况</a>》 一文中，有位热心读者 nbysy 在留言框里说了很多，大概意思有几点：</p>
<p>1、QQ 没有跟 Palringo 合作；</p>
<p>2、Palringo 私自通过“逆向协议”“不合法”地利用 QQ；</p>
<p>3、Palringo 有可能偷偷记录我的帐号跟密码；</p>
<p>4、QQ 在这么多 IM 中，帐号安全应该做的是最好的。</p>
<p>留言很长，我作为附件放在文章的后面供参考。一开始看到这个留言的时候，我很想回复，但是又不知道怎么回。后来我写信给 Palringo，17 天之后才收到回复，回复的内容大概如下：</p>
<p>1、Palringo 承认是通过一种非正式的技术链接到 QQ；</p>
<p>2、之所以出现 “您的 QQ 号码可能存在异常情况”提示，是因为 Palringo 的服务器在英国；</p>
<p>3、QQ 已经修改了自身协议，Palringo 之前所用的技术失效；</p>
<p>4、Palringo 正在寻找解决方法，但恐怕有待时日。</p>
<p>Palringo 是用英文回复的，原始内容同样作为附件放在此文最后。</p>
<p>结合 Palringo 的回复，可以看出 nbysy 的第一点和第二点是正确的，至于 Palringo 是否会“偷偷记录我的帐号跟密码”，我无法验证，不过我相信它不会。</p>
<p>而至于 QQ 的帐号安全是否是做得最好的，我也无法论证，不过我想说的是：</p>
<p><strong>为什么除了 QQ，MSN、GTalk、Facebook 等其他的 IM 工具都没有问题呢？</strong>难道是他们的帐户安全都不如 QQ？对此我深表怀疑。<strong>我认为 QQ 不给 Palringo 整合的根本原因不是为了帐号的安全，而是为了避免“肥水流外人田”。</strong>为什么这样说呢？因为 QQ 聊天软件上有大量的广告，有图为证：</p>
<p><img src="http://www.essentialblog.cn/image/qq-sucked.jpg" alt="QQ 广告" width="601" height="521" hspace="0" vspace="5"></p>
<p>一个对话框，就有三个明显的广告，而“点此免费拥有 QQ 秀”则至少有可能给腾讯网页带去流量。而如果用户通过 Palringo 或者其他第三方软件玩 QQ, 那么腾讯一丁点利益也捞不到，虽然 Palringo 也捞不到——它目前没有广告。 </p>
<p><strong>附件：</strong></p>
<p>1、nbysy 的留言： </p>
<blockquote>
<p>QQ怎么可能会跟palringo合作？ </p>
<p>只是palringo逆向了QQ的协议，然后假扮QQ的合法客户端与QQ交互。逆向QQ协议的客户<br />
  端一大堆，parlringo 不是第一个。 说到底，这些作法是不合法的。</p>
<p>又因为逆向的不完整或者逆向的协议版本太低，所以腾讯才会发现并警告异常。</p>
<p>这样的警告其实合情合理，因为许多盗用QQ或用QQ发广告的不法之徒就是用这些逆向的协议代码来自动登录QQ,然后做些自动化的操作。 腾讯有理由怀疑你的QQ已经被盗了。</p>
<p>另外，你试试用官方的手机版QQ登录试试看，会不会有问题。我怀疑出问题的可能性很小，因为我平时也经常用。分辩移动，电信，联通的接入点，这点能力QQ应该还是的，否则这么多手机QQ用户都要造反了。</p>
<p>如果QQ不是因为协议版本的问题而提出警告，而是其所说的“在国外异常登录”，那你应该还要怀疑的是，parlringo  是不是偷偷记录你的帐号跟密码，然后在国外登录了？或者，模拟QQ协议的软件模块是在parlringo的服务器上，所有消息都是经过parlringo  服务器中转的？</p>
<p>最后说句公道话，QQ在这么多IM中，帐号安全应该做的是最好的。你见过哪个IM被盗以后，还能通过申诉找回的？</p>
</blockquote>
<p>2、Palringo 的回复：</p>
<blockquote><p>Palringo was using an unofficial &#8216;bridge&#8217; to  connect to QQ who have now introduced a change in their protocol that  prevents this. We are looking into a solution but are expecting the QQ  service to remain inactive for the immediate future.</p>
<p>The foreign country log in will be due to the Palringo servers being situated in the UK &#8211; so nothing to work about. </p>
</blockquote>
<p align="left">-------------------------------------</p><br />
 <p align="left">&copy; 逛逛<a href="http://www.essentialblog.cn/">精品博客</a>，看看博客精品。| 转载请遵循“<a href="http://creativecommons.org/licenses/by-nc/2.5/cn/">署名-非商业性使用</a>”的创作共用协议。</p><br />
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/e-blog?a=CyTNt9F1a_Y:bzvQyTmFhtc:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/e-blog?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/e-blog?a=CyTNt9F1a_Y:bzvQyTmFhtc:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/e-blog?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/e-blog?a=CyTNt9F1a_Y:bzvQyTmFhtc:R_Hd-r7sPaA"><img src="http://feeds.feedburner.com/~ff/e-blog?d=R_Hd-r7sPaA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/e-blog/~4/CyTNt9F1a_Y" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.essentialblog.cn/qq-is-too-selfish-to-accept-palringo/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://www.essentialblog.cn/qq-is-too-selfish-to-accept-palringo/</feedburner:origLink></item>
	</channel>
</rss><!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
