<?xml version="1.0" encoding="utf-8"?><feed
  xmlns="http://www.w3.org/2005/Atom"
  xmlns:thr="http://purl.org/syndication/thread/1.0"
  xml:lang="en"
  xml:base="http://www.51eo.com/wp-atom.php"
   >
	<title type="text">无忧e游</title>
	<subtitle type="text">无忧无虑，一片纯净的天空……</subtitle>

	<updated>2008-05-11T14:53:25Z</updated>
	<generator uri="http://wordpress.org/" version="2.3.3">WordPress</generator>

	<link rel="alternate" type="text/html" href="http://www.51eo.com" />
	<id>http://www.51eo.com/feed/atom</id>
	<link rel="self" type="application/atom+xml" href="http://www.51eo.com/feed/atom" />

			<entry>
		<author>
			<name>无忧</name>
					</author>
		<title type="html"><![CDATA[测试中文章]]></title>
		<link rel="alternate" type="text/html" href="http://www.51eo.com/test-article.html" />
		<id>http://www.51eo.com/test-article.html</id>
		<updated>2008-05-11T08:57:45Z</updated>
		<published>2008-05-11T08:57:45Z</published>
		<category scheme="http://www.51eo.com" term="依网情深" /><category scheme="http://www.51eo.com" term="心语飘香" /><category scheme="http://www.51eo.com" term="指点江山" /><category scheme="http://www.51eo.com" term="明晖之光" /><category scheme="http://www.51eo.com" term="清扬婉兮" /><category scheme="http://www.51eo.com" term="笑傲江湖" /><category scheme="http://www.51eo.com" term="苍海桑田" /><category scheme="http://www.51eo.com" term="茶园观色" /><category scheme="http://www.51eo.com" term="走马看花" /><category scheme="http://www.51eo.com" term="锦瑟流年" /><category scheme="http://www.51eo.com" term="青梅煮酒" />		<summary type="html"><![CDATA[测试中文章测试中文章... ]]></summary>
		<content type="html" xml:base="http://www.51eo.com/test-article.html"><![CDATA[<p>测试中文章测试中文章</p>
]]></content>
	</entry>
		<entry>
		<author>
			<name>无忧</name>
					</author>
		<title type="html"><![CDATA[照片 测试]]></title>
		<link rel="alternate" type="text/html" href="http://www.51eo.com/photo-test.html" />
		<id>http://www.51eo.com/photo-test.html</id>
		<updated>2008-05-11T00:57:48Z</updated>
		<published>2008-05-11T00:57:48Z</published>
		<category scheme="http://www.51eo.com" term="明晖之光" />		<summary type="html"><![CDATA[照片 测试... ]]></summary>
		<content type="html" xml:base="http://www.51eo.com/photo-test.html"><![CDATA[<p>照片 测试</p>
]]></content>
	</entry>
		<entry>
		<author>
			<name>无忧</name>
					</author>
		<title type="html"><![CDATA[掌上电脑 测试]]></title>
		<link rel="alternate" type="text/html" href="http://www.51eo.com/pocket-pc-test.html" />
		<id>http://www.51eo.com/pocket-pc-test.html</id>
		<updated>2008-05-11T00:56:07Z</updated>
		<published>2008-05-11T00:55:10Z</published>
		<category scheme="http://www.51eo.com" term="指点江山" />		<summary type="html"><![CDATA[掌上电脑... ]]></summary>
		<content type="html" xml:base="http://www.51eo.com/pocket-pc-test.html"><![CDATA[<p>掌上电脑</p>
]]></content>
	</entry>
		<entry>
		<author>
			<name>无忧</name>
					</author>
		<title type="html"><![CDATA[wordpress主题制作必知]]></title>
		<link rel="alternate" type="text/html" href="http://www.51eo.com/wordpress-theme-that-will-be-produced.html" />
		<id>http://www.51eo.com/wordpress-theme-that-will-be-produced.html</id>
		<updated>2008-05-10T10:58:33Z</updated>
		<published>2008-05-10T10:58:33Z</published>
		<category scheme="http://www.51eo.com" term="锦瑟流年" />		<summary type="html"><![CDATA[Wordpress模板文件中要使用的一些内置函数:
&#60;?php bloginfo(’stylesheet_url’); ?&#62;&#160;&#160;显示style.css文件路径.
&#60;?php bloginfo(’name’); ?&#62;&#160;&#160;显示当前Blog的标题.
&#60;?php bloginfo(’url’); ?... ]]></summary>
		<content type="html" xml:base="http://www.51eo.com/wordpress-theme-that-will-be-produced.html"><![CDATA[<p id="postmessage_794" class="t_msgfont">Wordpress模板文件中要使用的一些内置函数:</p>
<p>&lt;?php <span href="tag.php?name=blog" onclick="tagshow(event)" class="t_tag">blog</span>info(’stylesheet_url’); ?&gt;&nbsp;&nbsp;显示style.css文件路径.</p>
<p>&lt;?php bloginfo(’name’); ?&gt;&nbsp;&nbsp;显示当前Blog的标题.</p>
<p>&lt;?php bloginfo(’url’); ?&gt; 显示当前Blog的URL地址.</p>
<p>&lt;?php bloginfo(’description’); ?&gt; 显示当前Blog的描述.</p>
<p>&lt;?php if(have_posts()) : ?&gt;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;是否有<span href="tag.php?name=%E6%97%A5%E5%BF%97" onclick="tagshow(event)" class="t_tag">日志</span><br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;?php while(have_posts()) :&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;如果有日志,循环继续<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; the_post(); ?&gt;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;取出该日志<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;?php the_title(); ?&gt;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 当前取出的日志的标题<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;?php the_permalink(); ?&gt;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;该日志的<span href="tag.php?name=%E9%93%BE%E6%8E%A5" onclick="tagshow(event)" class="t_tag">链接</span>地址<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;?php the_content(); ?&gt;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 该日志的内容<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;?php the_excerpt(); ?&gt;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 该日志的摘要<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;?php the_category(’, ‘) ?&gt;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;显示当前日志所在分类列表,逗号隔开<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;?php the_author(); ?&gt;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;输出当前日志作者的名字。<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;?php comments_popup_link(’No Comments &gt;’, ‘1 Comment &gt;’, ‘% Comments &gt;’); ?&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;当弹出留言的功能激活的话，comments_popup_link() 调用一个弹出的留言<span href="tag.php?name=%E7%AA%97%E5%8F%A3" onclick="tagshow(event)" class="t_tag">窗口</span>。<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;如果没有激活，comments_popup_link() 则只是简单的显示留言列表。<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;No Comments &gt; 是在没有留言的时候显示的。<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;1 Comment &gt; 是用于当你刚好有1条留言时候。<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;% Comments &gt;; 是用于当你有多于一条留言的时候。<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;比如：8 Comments &gt;。百分号 % 用来显示数字。&gt; 是用来显示一个双层箭头 &gt;。<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;?php edit_post_link(’Edit’, ‘ | ‘, ”); ?&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;这个只有当你以管理员身份登录的的时候（以编辑者，Editor登录也可以）才可见。<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;edit_post_link() 只是简单为你显示一个可以用来编辑当前日志的编辑链接<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;这样可以让你不必去去管理界面搜寻该日志而能直接编辑。<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;edit_post_link() 有三个参数。<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;第一个是用来确定哪个词你将用在编辑链接的链接标题。<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;如果你使用 Edit post，那么将显示 Edit post 而不是 Edit。<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;第二个参数是用来显示在链接前面的字符，在这里是竖线 |，代码就是&amp;124;。<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;第三个参数是用于显示在编辑链接后面的字符，在这里没有使用。<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;?php the_ID(); ?&gt;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 当前日志的ID<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;?php endwhile; ?&gt;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;关闭while<br>
&lt;?php endif; ?&gt;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 关闭if</p>
<p>&lt;?php posts_nav_link(); ?&gt;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;显示分页链接<br>
&lt;?php posts_nav_link(’in between’,'before’,”after’); ?&gt;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;定制分页链接的显示方式<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;第1个参数是显示在后一页和前一页链接的中间。<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;第2个参数显示在前面。<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;第3个参数显示在后面。</p>
<p>&lt;?php previous_post_link(’&lt; %link’) ?&gt;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 前一篇日志的链接</p>
<p>&lt;?php next_post_link(’ %link &gt;’) ?&gt;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 后一篇日志的链接</p>
<p>&lt;?php link_pages(’&lt;p&gt;&lt;strong&gt;Pages:&lt;/strong&gt; ‘, ‘&lt;/p&gt;’, ‘number’); ?&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;显示子页面的链接<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;在编辑<span href="tag.php?name=wordpress" onclick="tagshow(event)" class="t_tag">wordpress</span>页面时,加上&lt;!–nextpage–&gt;即可以让下面的内容分页<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;上面的语句最终显示效果:&nbsp;&nbsp;Pages: 1 2 3</p>
<p>_e() 以便你的主题可翻译化<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;如: &lt;?php _e(’Categories’); ?&gt;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;输出字符 Categories.</p>
<p>&lt;?php wp_list_cats(); ?&gt;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;调用分类链接列表<br>
wp_list_cats(’sort_column=name&amp;optioncount=1&amp;hierarchical=0′); ?&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;参数的说明<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;sort_column=name - 把分类按字符顺序排列<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;optioncount=1 - 显示在每个分类下面的日志数<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;hierarchial=0 - 不把子分类放到子列表元素中，这就解释了为什么我的 子分类 链接是列在列表中第一级。<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&amp; - 每次你增加另一个参数的时候，你需在它之前要输入 &amp; 用来把和现有的参数区分开。如 &amp; 在 sort_column 和 optioncount之间。</p>
<p>&lt;?php wp_list_pages(); ?&gt;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;日志链接列表<br>
&lt;?php wp_list_pages(’title_li=&lt;h2&gt;Page&lt;/h2&gt;’); ?&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;定义标题 “Page” 的样式<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;title_li 是一个用来客户化页面链接列表的标题的参数。<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;h2&gt;Pages&lt;/h2&gt; 是 title_li 这个参数的值<br>
&lt;?php wp_list_pages(’depth=3&amp;title_li=&lt;h2&gt;Page&lt;/h2&gt;’); ?&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;为了限制显示列表的层数，可以增加 depth 这个参数<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;上面的代码定义了只显示3级别的链接</p>
<p>&lt;?php wp_get_archives(’type=monthly’); ?&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;按月调用存档列表链接，并把每个链接放入 &lt;li&gt; 和 &lt;/li&gt; <span href="tag.php?name=%E6%A0%87%E7%AD%BE" onclick="tagshow(event)" class="t_tag">标签</span>中。<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;wp_get_archives() 为每个链接产生了列表元素(LI)标签</p>
<p>&lt;?php get_links_list(); ?&gt;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;显示<span href="tag.php?name=%E5%8F%8B%E6%83%85" onclick="tagshow(event)" class="t_tag">友情</span>链接</p>
<p>&lt;?php include(TEMPLATEPATH.’/搜索页面’); ?&gt;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;向页面添加搜索框<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;TEMPLATEPATH&nbsp;&nbsp;是wp中主题文件夹的位置</p>
<p>&lt;?php get_calendar(); ?&gt;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;使用日历功能</p>
<p>&lt;?php wp_register(); ?&gt;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;管理链接,未登录显示注册链接</p>
<p>&lt;?php wp_loginout(); ?&gt;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;登录链接,如果已登录则显示为退出</p>
<p>&lt;?php wp_meta(); ?&gt;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;使用Meta功能<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;使用 wp_register();或wp_loginout();需要在后面加上此函数</p>
<p>&lt;?php if ( function_exists(’dynamic_sidebar’) &amp;&amp; dynamic_sidebar() ) : else : ?&gt;<br>
&lt;?php _e(’不支持窗体化侧边栏’); ?&gt;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 使用Widget <span href="tag.php?name=%E6%8F%92%E4%BB%B6" onclick="tagshow(event)" class="t_tag">插件</span>来窗体化侧边栏<br>
&lt;?php endif; ?&gt;</p>
<p>&lt;?php get_header(); ?&gt;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;包含header.php文件(头部信息)</p>
<p>&lt;?php get_sidebar(); ?&gt;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;包含sidebar.php文件(侧边栏)</p>
<p>&lt;?php get_footer(); ?&gt;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;包含footer.php文件(脚注信息)</p>
<p>&lt;?php comments_template(); ?&gt;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;包含comments.php文件(评论)</p>
<p>style.css中描述主题的一些信息,格式如下:<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;第一行显而易见就是主题的名字。<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;第二行是这个主题的地址，如果你的主题只是私用的而不准备发布的话，那就不用考虑它。<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;第三行是主题的描述。<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;第四行是版本号，这是非常重要的，特别是当你公<span href="tag.php?name=%E5%BC%80%E5%8F%91" onclick="tagshow(event)" class="t_tag">开发</span>布你主题新版本的时候。<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;第五和第六行分别是你的名字和主页。<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;范例:<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;Theme Name: WordPress Default<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;Theme URI: <a target="_blank" href="http://wordpress.org/">http://wordpress.org/</a><br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;Description: The default WordPress theme based on the famous &lt;a href=”http://binarybonsai.com/kubrick/”&gt;Kubrick&lt;/a&gt;.<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;Version: 1.6<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;Author: Michael Heilemann<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;Author URI: <a target="_blank" href="http://binarybonsai.com/">http://binarybonsai.com/</a></p>
<p>wordpress主题中的模板文件的内容格式:<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;1. archive.php 和 search.php 模板文件是相同的。<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;2.Pages （和日志不同）是没有分类的，他们同样没有后一页和前一页的链接。有的只是上一篇日志和下一篇日志<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;3.Single.php 不会显示留言链接（被 comments_popup_link() 函数调用）并且他不用 posts_nav_link() 去调用<span href="tag.php?name=%E5%AF%BC%E8%88%AA" onclick="tagshow(event)" class="t_tag">导航</span>链接。</p>
]]></content>
	</entry>
		<entry>
		<author>
			<name>无忧</name>
					</author>
		<title type="html"><![CDATA[wordpress主题模版制作教程]]></title>
		<link rel="alternate" type="text/html" href="http://www.51eo.com/wordpress-theme-template-production-guide.html" />
		<id>http://www.51eo.com/wordpress-theme-template-production-guide.html</id>
		<updated>2008-05-10T10:54:42Z</updated>
		<published>2008-05-10T10:54:42Z</published>
		<category scheme="http://www.51eo.com" term="锦瑟流年" />		<summary type="html"><![CDATA[学习本教程，需要：

对PHP，WP，CSS，PS有一定的基础，懂得初步的应用。
你是一个想要表现自己的家伙，并且不想再使用别人制作的主题。
你要有耐心，细心，细心，耐心

WP 主题简介
在详细... ]]></summary>
		<content type="html" xml:base="http://www.51eo.com/wordpress-theme-template-production-guide.html"><![CDATA[<p class="PostContent">学习本教程，需要：</p>
<ol>
<li>对PHP，WP，CSS，PS有一定的基础，懂得初步的应用。</li>
<li>你是一个想要表现自己的家伙，并且不想再使用别人制作的主题。</li>
<li>你要有耐心，细心，细心，耐心<span id="more-19"></span></li>
</ol>
<h3><font color="#339966">WP 主题简介</font></h3>
<p>在详细分解代码之前，我们还是要先了解一下WP主题的大致情况。一个 WP 的主题是由几个 templates 文件组成的，每一个主题必有的二个文件是：index.php 和 style.css，除此之外还有一些其它的文件（不是必须），它们和 index.php 文件间存在优先级关系，如果它们存在，WP 模板系统就会调用它们显示相应的页面，否则模板系统会调用 index.php 来显示。</p>
<p>它们有可能是以下文件：</p>
<ul>
<li>single.php –&nbsp;单一日志文件，用于显示单一日志</li>
<li>page.php — 页面模板文件，用于显示静态页面</li>
<li>archive.php — 存档文件，用于显示存档页面</li>
<li>category.php — 类别文件，用于显示类别页面</li>
<li>search.php — 搜索文件，用于显示搜索结果</li>
<li>404.php — 错误文件，用于显示404页面</li>
<li>comments.php — 评论文件，用于显示评论和评论框</li>
</ul>
<h3><font color="#339966">index.php<br></font></h3>
<p>首先制作index.php，我们知道在一个网页中，代码主要分为二部分，一个是页头信息，一个是页面内容。<br>
<span style="color: #0000ff">&lt;</span><span style="color: #800000">html</span><span style="color: #0000ff">&gt;</span><br>
<span style="color: #0000ff">&lt;</span><span style="color: #800000">head</span><span style="color: #0000ff">&gt;</span><br>
………页头信息<br>
<span style="color: #0000ff">&lt;/</span><span style="color: #800000">head</span><span style="color: #0000ff">&gt;</span><br>
<span style="color: #0000ff">&lt;</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span><br>
………页面内容<br>
<span style="color: #0000ff">&lt;/</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span><br>
<span style="color: #0000ff">&lt;/</span><span style="color: #800000">html</span><span style="color: #0000ff">&gt;<br>
<font color="#000000">每个主题的页头信息都是几乎一样，具体可以查看默认模板的 header.php 文件（为保证所有页面的页头信息的一致性，所有页头信息都放在 header.php 文件）。</font></span></p>
<p><span style="color: #0000ff"><font color="#000000"><br></font></span>接下来我们谈下一话题，关于母猪的产后护理……（我学的太杂了，都弄混了）<br>
我们来谈一下body中的内容。它包含四个部分，每一部分都可以叫做一个集成模块，其实一个主题就是由不同的模块构成，模块又是由不同的模块构成。</p>
<ul>
<li><font color="#000000">header&nbsp; WP 的顶部，显示博客的名字与描述，放置导航栏，搜索栏等等。&nbsp;</font></li>
<li><font color="#000000">content&nbsp; WP 的正文部分，显示贴子的内容，作者，时间，分类，评论，编辑等等。</font></li>
<li><font color="#000000">sidebar&nbsp; WP 的侧边栏部分。</font></li>
<li><font color="#000000">footer&nbsp;&nbsp; WP 的尾部，这部分只有很少的内容，通常是版权信息。</font></li>
</ul>
<p>对于每一个集成模块中的内容，理论上是可以随意放置的，比如我们可以把header模块中的搜索栏放在sidebar模块中去。那如何区分这四个集成模块呢？看以下代码。<br>
&lt;div id=”header”&gt;<br>
&nbsp;这是我的博客名字<br>
&lt;/div&gt;<br>
&lt;div id=”content”&gt;<br>
&nbsp;这是我写的贴子<br>
&lt;/div&gt;<br>
&lt;div id=”sidebar”&gt;<br>
&nbsp;友情链接，搜索栏<br>
&lt;/div&gt;<br>
&lt;div id=”footer”&gt;<br>
&nbsp;版权所有：我是二道<br>
&lt;/div&gt;&nbsp;<br>
通过div标签，我们可以把这些个模块分隔开来。<br>
现在开始我们第一部分的代码块，不过在写代码之前我还得要啰嗦一句，这不是我说的，是我爱水煮鱼说的，写代码要有层次感，要记得使用缩进，缩进不是空格，不是用你键盘上最长的那个键，而是TAB这个键。</p>
<h3><font color="#339966">header<br></font></h3>
<p>&lt;div id=”header”&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;h1&gt;&lt;a href=”&lt;?php bloginfo(’url’);?&gt;”&gt;&lt;?php bloginfo(’name’);?&gt;&lt;/a&gt;&lt;/h1&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php bloginfo(’description’);?&gt;<br>
&lt;/div&gt;&nbsp;<br>
id是div的一个属性，为id赋于不同的值，这样就可以区分每一个div代码段。&nbsp;<br>
bloginfo()是WP中定义好的函数，参数url代表网址，参数name代表网站的名字，参数description代表对网站的自我描述。<br>
在上面的代码中，就是为网站的名字加上一个超链接,并且显示描述。<br>
这一部份代码也是存放于header.php文件中，在index.php文件中只要用一行代码就可以调用到<br>
&lt;?php get_header(); ?&gt;<br>
这样的好处是，你只要修改一下header.php文件，所有调用这个文件的页面都会跟随改变，而不用一个一个地去修改了。</p>
<p class="PostContent"></p>
<h3><font color="#008080">content</font></h3>
<p>现在开始我们第二部分的代码块<br>
&lt;div id=”content”&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;?php if(have_posts()) : ?&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;?php while(have_posts()) : the_post(); ?&gt;</p>
<p>&nbsp;&nbsp;&nbsp; &lt;?php endwhile; ?&gt;</p>
<p>&nbsp;&nbsp;&nbsp; &lt;?php endif; ?&gt;<br>
&lt;/div&gt;<span id="more-20"></span><br>
这里调用if(have_potst())来检测是否有文章存在，如果有的话，就用while循环显示。the_post()就是调用文章的函数。<br>
而每一篇文章又是有标题，有写作时间，有分属类别，有读者的评论，这些又全部需要用div标签来分隔开。<br>
看下面的代码<br>
&lt;div id=”content”&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;?php if(have_posts()) : ?&gt;&lt;!–开始检测–&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;?php while(have_posts()) : the_post(); ?&gt;&lt;!–以下面的格式显示每篇文章–&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;div class=”post”&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;h2&gt;&lt;a href=”&lt;?php the_permalink();?&gt;”&gt;&lt;?php the_title();?&gt;&lt;/a&gt;&lt;/h2&gt;&lt;!–文章的标题，含有链接地址–&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;div class=”entry”&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php the_content();?&gt;&lt;!–文章的内容–&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;p class=”postmetadata”&gt;&lt;!–文章后面跟随的内容–&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php _e(’Filed under:’);?&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php the_category(’,’);?&gt;&lt;!–调用当前文章的分类–&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php _e(’by’);?&gt;&lt;!–创建可以翻译的主题–&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php the_autnor(”);?&gt;&lt;!–调用文章的作者–&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;br /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php comments_poopup_link(’No Comments»’,’1 Comments»’,’% Comment»’);?&gt;&lt;!–调 用一个弹出的留言窗口，如果这个功能没有激活，则是显示留言列表–&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php edit_post_link(’Edit’,’|’,”);?&gt;&lt;!–只有在登陆后才可见到，对文章进行编辑的链接–&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/p&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/div&gt;&lt;!–文章内容彻底结束–&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/div&gt;&lt;!–一篇文章终于结束–&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp; &lt;?php endwhile; ?&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;?php endif; ?&gt;<br>
&lt;/div&gt;<br>
class<br>
现在我们得要说说class了，它与id都是标签的属性，但是不同之处在于，<br>
id的参数值是唯一的，它只能使用一次，而class的参数值是可以多次使用，<br>
比如id=”header”只能用一次，因为我们只有一个地方可以出现博客的名字。<br>
而class=”entry”会经常出现，那是因为我们的博客里不只是有一篇文章。<br>
为什么我们要用到id与class，难道只用一个不行吗，反正功能都是相同的。<br>
不要忘了我们前面说过的一个重要文件，style.css样式表文件。<br>
我们为某一段代码添加了属性，如同起个名字而已，这样在样式表中我们就可以为这些名字来定制它们的样式了。<br>
这样说你还不明白？那就打个最简单的比方吧，你可以有很多的兄弟，但是你们只能有一个爹，<br>
你不能用你爹的名字叫你的兄弟，但是你爹可以用你兄弟的名字叫你。<br>
样式表文件就和你奶奶一样，你爹再牛逼也得听你奶奶的话，叫他怎么样他就得要怎么样。<br>
Not Found<br>
前面的代码中有说到，如果检测到有文章的话，就用循环调出来，可是如果没有文章的话那要怎么样呢？<br>
&lt;?php else:?&gt;<br>
&lt;div class=”post” id=”post-&lt;?php the_ID(); ?&gt;”&gt;<br>
&lt;?php _e(’Not Found’);?&gt;<br>
&lt;/div&gt;<br>
把这一段代码加在&lt;?php endwhile; ?&gt;之后就可以了。</p>
<h3>页面导航</h3>
<p>当你的博客内容越来越多的时候，在WP的后台又设定了首页只显示10个文章，那么从第11个开始都无法在首页显示出来。<br>
这样在博客的最后一篇文章下面就会出现下一页或是前一页的链接。如果你还不到10个文章，这个链接就不会出现。<br>
把下面的代码加入到&lt;?php else:?&gt;前面<br>
&lt;div class=”navigation”&gt;<br>
&lt;?php posts_nav_link(); ?&gt;<br>
&lt;/div&gt;<br>
分析一下posts_nav_link()，它可以有三个参数<br>
&nbsp;posts_nav_link(’in between’,’before’,’after’)<br>
第1个参数是显示在后一页和前一页链接的中间。第2个参数显示在后一页和前一页链接的前面。第3个参数显示在后一页和前一页链接的后面。<br>
用什么来显示，你自己决定，常用的就是一些符号或是箭头而已嘛。<br>
现在再看一下index.php文件中我们已经有了哪些个代码<br>
&lt;?php get_header(); ?&gt;<br>
&lt;div id=”content”&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;?php if(have_posts()) : ?&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;?php while(have_posts()) : the_post(); ?&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;div class=”post”&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;h2&gt;&lt;a href=”&lt;?php the_permalink();?&gt;”&gt;&lt;?php the_title();?&gt;&lt;/a&gt;&lt;/h2&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;div class=”entry”&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php the_content();?&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;p class=”postmetadata”&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php _e(’Filed under:’);?&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php the_category(’,’);?&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php _e(’by’);?&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php the_autnor(”);?&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;br /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php comments_poopup_link(’No Comments»’,’1 Comments»’,’% Comment»’);?&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php edit_post_link(’Edit’,’|’,”);?&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/p&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/div&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/div&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp; &lt;?php endwhile; ?&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;div class=”navigation”&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php posts_nav_link(); ?&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/div&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;?php else:?&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;div class=”post” id=”post-&lt;?php the_ID(); ?&gt;” &gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php _e(’Not Found’);?&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/div&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;?php endif; ?&gt;<br>
&lt;/div&gt;<br>
**********************************************************<br>
写教程不是一个简单的事，它不光让我心烦，还让我难以找到适当的词来表达，所以要体会一下当老师的难处。<br>
*********************************************************</p>
<p><font color="#339966">侧边栏</font>&nbsp;</p>
<p>第三部分，关于侧边栏。侧边栏有一个特点，就是又臭又长，当然了这不是什么缠脚布。先不要乱扯。<br>
因为地形有限，所以侧边栏里的内容，多以列表的形式排开。下面欢迎一对父子出场，他们的感情是相当的好，从来都是父子不分家，有父必有子，有子必有父，父中有子，子中有父。他们就是&lt;UL&gt;与&lt;LI&gt; !!!!!!!</p>
<p>&lt;div class=”sidebar”&gt;&lt;!–注意这里使用的不是id–&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;ul&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;li&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;h2&gt;&lt;?php _e(’文章分类’); ?&gt;&lt;/h2&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/li&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/ul&gt;<br>
&lt;/div&gt;<br>
ul表示无序列表，li表示有序列表。<br>
在侧边栏里，你要有几个不同的栏目，栏目的存在，就是为侧边栏进行了分类整理。<br>
每一个栏目又要有不同的分类列表，继续为上面的代码添加内容。<br>
&lt;div class=”sidebar”&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;ul&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;h2&gt;&lt;?php _e(’文章分类’); ?&gt;&lt;/h2&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ul&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php wp_list_cats(’sort_column=name&amp;optioncount=1&amp;hierarchical=0′); ?&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/ul&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/li&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/ul&gt;<br>
&lt;/div&gt;<br>
wp_list_cats()函数为调用文章分类列表，它的参数也有三个。每个参数之间用&amp;来分隔。<br>
sort_column=name - 把分类按字符顺序排列<br>
optioncount=1 - 显示在每个分类下面的文章数<br>
hierarchial=0 - 不把子分类放到子列表条目中<br>
********************************************************************************<br>
<font color="#008080">静态页面</font></p>
<p>说到分类，特别说一下页面这个栏目。我们在WP后台撰写的时候，有二个选择，一个是撰写文章，一个是撰写页面。<br>
对于文章，还可以选择保存在哪一个具体的分类下面。对于页面就没得选择，只收录于页面栏目之下。 再回到前台，<br>
你可以看到每个文章分类都有显示文章的数目，而不显示标题。<br>
在页面栏目里，只排列了每一个页面的标题，而不显示数目。</p>
<p>&lt;?php wp_list_pages(’depth=3&amp;title_li=”&lt;h2&gt;页面&lt;/h2&gt;’); ?&gt;</p>
<p>参数depht=3为可选参数，表示可以设定显示三级列表。<br>
*******************************************************************************<br>
注意一点，本教程的代码是制作模版的代码，在WP中使用一个主题也就是等于在套用一个模版。<br>
在网站中查看源代码是看不到模版的代码的。<br>
&lt;li&gt;&lt;h2&gt;&lt;?php _e(’文章分类’); ?&gt;&lt;/h2&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ul&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php wp_list_cats(’sort_column=name&amp;optioncount=1&amp;hierarchical=0′); ?&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/ul&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/li&gt;<br>
上面这一段模版代码，在网页中查看源代码，实际上显示的是这样的<br>
&lt;li&gt;&lt;h2&gt;文章存档&lt;/h2&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;ul&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href=”#” mce_href=”#”&gt;与爱情有关的分类贴子&lt;/a&gt;&lt;/li&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href=”#” mce_href=”#”&gt;与生活有关的分类贴子&lt;/a&gt;&lt;/li&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ………………………………………………<br>
&nbsp;&nbsp;&nbsp; &lt;/ul&gt;<br>
&lt;/li&gt;<br>
**********************************************************************************<br>
增加一个存档栏目<br>
&lt;li&gt;&lt;h2&gt;&lt;?php _e(’文章存档’); ?&gt;&lt;/h2&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;ul&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php wp_get_archives(’type=monthly’); ?&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/ul&gt;<br>
&lt;/li&gt;<br>
wp_get_archives()函数是获取文章存档的方法，参数’type=monthly’定义为以每个月的时间来进行分类存档<br>
********************************************************************************<br>
增加一个友情链接栏目</p>
<p>&lt;?php get_links_list(); ?&gt;<br>
不用担心没有实际内容，它会自动调用在WP后台中添加的友情链接。<br>
********************************************************************************<br>
增加一个搜索栏目</p>
<p>&lt;li id=”search”&gt;<br>
&lt;?php include(TEMPLATEPATH. ‘/searchform.php’); ?&gt;<br>
&lt;/li&gt;<br>
使用include()函数调用一个文件，参数TEMPLATEPATH为文件的目录文件夹，为了调用成功，你还需要有一个文件，<br>
searchform.php——&gt;代码请看这里。<br>
*******************************************************************************<br>
增加一个日历栏目</p>
<p>&lt;li id=”calendar”&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;h2&gt;&lt;?php _e(’日历’); ?&gt;&lt;/h2&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;?php get_calendar(); ?&gt;<br>
&lt;/li&gt;<br>
这里就不用多废话了。<br>
********************************************************************************<br>
增加一个管理栏目</p>
<p>&lt;li&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;h2&gt;&lt;?php _e(’管理’); ?&gt;&lt;/h2&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;ul&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php wp_register(); ?&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;li&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php wp_loginout(); ?&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/li&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php wp_meta(); ?&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/ul&gt;<br>
&lt;/li&gt;<br>
wp_loginout()来确定你是否登陆，如果登陆就显示登出链接，如果没有登陆，就显示登陆的链接。<br>
wp_register()来确定你的身份，如果没有登陆，就显示注册的链接，如果有的话，就显示管理的链接。<br>
而wp_meta()却是什么也没有做。也不用去理它，还没有人来说明它是起什么作用的。实际上它是 WordPress 的hook。<br>
********************************************************************************<br>
<font color="#008080">窗体化侧边栏</font></p>
<p>&lt;?php&nbsp;&nbsp;&nbsp;&nbsp; /* Widgetized sidebar, if you have the plugin installed. */<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( !function_exists(’dynamic_sidebar’) || !dynamic_sidebar() ) : ?&gt;<br>
在侧边栏开始的地方第一个&lt;ul&gt;的后面，加上以上代码。也要在侧边栏结束的地方&lt;/ul&gt;前面加上一句</p>
<p>&lt;?php endif; ?&gt;</p>
<p>从WP2.0开始，已经在后台集成了一个侧边栏的插件－－Widgetized，它的功能就是可以很方便的在WP后台调整侧边栏中的内容，直接使用鼠标就可以移动每一个栏目的位置，而不需要去修改相应的代码。让每一个栏目都以窗体化存在。<br>
function_exists(’dynamic_sidebar’) || !dynamic_sidebar()这两个参数来自于一个新的文件－－functions.php,<br>
我们需要创建这个文件才可以完成侧边栏的窗体化－－－－&gt;&gt;代码在这里<br>
*******************************************************************************<br>
通过观察不同的WP主题，会发现在侧边栏中的内容远不止以上所列举的，<br>
要在学习中举一反三，才会制作出更加出众的主题。<br>
*******************************************************************************<br>
至此，侧边栏中的内容结束，我们也可以把第三部分的代码另存为一个新的文件－－sidebar.php,<br>
在index.php中填加一句代码就可以使用侧边栏<br>
&lt;?php get_sidebar(); ?&gt;<br>
顺便再增加一行代码<br>
&lt;?php get_footer();?&gt;<br>
这是调用尾部文件footer.php的代码。我想你应该知道如何处理一个简单的PHP文件了，要么你就再重头学一次本教程。<br>
*****************************************************************************<br>
再一次查看一下index.php有了哪些代码</p>
<p>&lt;?php get_header(); ?&gt;<br>
&lt;div id=”content”&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;?php if(have_posts()) : ?&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;?php while(have_posts()) : the_post(); ?&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;div class=”post”&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;h2&gt;&lt;a href=”&lt;?php the_permalink();?&gt;”&gt;&lt;?php the_title();?&gt;&lt;/a&gt;&lt;/h2&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;div class=”entry”&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php the_content();?&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;p class=”postmetadata”&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php _e(’Filed under:’);?&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php the_category(’,’);?&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php _e(’by’);?&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php the_autnor(”);?&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;br /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php comments_poopup_link(’No Comments»’,’1 Comments»’,’% Comment»’);?&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php edit_post_link(’Edit’,’|’,”);?&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/p&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/div&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/div&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp; &lt;?php endwhile; ?&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;div class=”navigation”&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php posts_nav_link(); ?&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/div&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;?php else:?&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;div class=”post” id=”post-&lt;?php the_ID(); ?&gt;” &gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php _e(’Not Found’);?&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/div&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;?php endif; ?&gt;<br>
&lt;/div&gt;<br>
&lt;?php get_sidebar(); ?&gt;<br>
&lt;?php get_footer();?&gt;<br>
index.php文件的代码已经全在这里了，但是只有第二部分内容需要详细的代码，而其它的部分我们都可以调用外部文件，<br>
至此一个WP的主题构造已经搭建好，再一次提醒各位，检查代码，确认书写正确。只有不厌其烦地写代码才会对代码有更深刻的印像。<br>
***********************************************************************************<br>
下面开始创建其它文件<br>
*******************************************<br>
将index.php的全部代码另存为archive.php，并且把the_content 改成 the_excerpt，<br>
创建存档文件，它会显示在分类栏目下的每篇文章的摘要。<br>
*******************************************<br>
如何创建category.php????<br>
方法同上面一样，就连代码也一样，中是改个名而已，哈哈哈。</p>
<p>*******************************************<br>
将archive.php另存为search.php,创建搜索文件，这样就可以在搜索中得到每篇文章的摘要。<br>
*******************************************<br>
将index.php的全部代码另存为page.php，创建页面文件<br>
在 &lt;?php the_content(); ?&gt; 下面输入以下代码：</p>
<p>&lt;?php link_pages(’&lt;p&gt;&lt;strong&gt;Pages:&lt;/strong&gt; ‘, ‘&lt;/p&gt;’, ‘number’); ?&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 说明：如果一个页面，篇幅超长的话，我们可以把它截断分成几页来显示，</p>
<p>&lt;?php edit_post_link(’Edit’, ‘&lt;p&gt;’, ‘&lt;/p&gt;’); ?&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 说明：显示一个可以编辑的链接&nbsp;<br>
删除掉&lt;p class=”postmetadata”&gt;至&lt;/p&gt;这一块的代码<br>
删除掉&lt;div class=”navigation”&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php posts_nav_link(); ?&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/div&gt;<br>
说明：对于页面，它没有属于哪个分类，我们也不希望被某人评论，当然它也不能显示与另一个页面间的连接，所在要去掉一部分代码。<br>
******************************************<br>
将index.php的全部代码另存为single.php，创建单篇文章文件，点击文章的标题，可以查看全文内容。<br>
在 &lt;?php the_content() ?&gt; 下输入：</p>
<p>&lt;?php link_pages(’&lt;p&gt;&lt;strong&gt;Pages:&lt;/strong&gt; ‘, ‘&lt;/p&gt;’, ‘number’); ?&gt;<br>
这段代码和上一例相同，都是可以用来截断文章。</p>
<p>删除&lt;br /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;?php comments_poopup_link(’No Comments»’,’1 Comments»’,’% Comment»’);?&gt;<br>
把&lt;?php posts_nav_link(); ?&gt;：<br>
替换成&lt;?php previous_post_link(’« %link’) ?&gt; &lt;?php next_post_link(’ %link »’) ?&gt;<br>
说明：在单篇文章的下面显示的应是上一篇与下一篇的链接，而不是上一页与下一页的链接。</p>
<p>***************************************<br>
<font color="#008080">如何处理留言评论？</font></p>
<p>想一想，每一个留言评论都是对于一个文章而产生的，所以只要在单篇文章页面里添加一个调用评论的函数就可以<br>
在 single.php 文件中，&lt;div class=”entry”&gt;代码块结束的&lt;/div&gt;下面，输入以下代码：<br>
&lt;div class=”comments-template”&gt;<br>
&lt;?php comments_template(); ?&gt;<br>
&lt;/div&gt;<br>
comments_template()这个函数是用来从 comments.php 文件调用评论模板。<br>
所以我们还要创建一个comments.php文件。<br>
*****************************************</p>
<p>模版的代码已经写完，接下来要做的就是如何美化模版。<br>
到目前为止还没有提到过一张图片的名字，所以我要你开始构思你的模版，<br>
用PS做出相应位置的图片，然后在style.css文件中去美化它们吧。</p>
<p class="PostContent">经过前面的PHP文件制作，我们的主题上已经有了许多的零部件了，但是还没有达到完美的程度，它们就如同一堆乱七八糟的杂物，所以我们还要制作一个样式表文件 ：style.css，为它们安排好自已的位置。</p>
<p>避免误人子弟，我特意找出我的CSS书，重新温习一遍。发现还是2001年买回来的呢。可是这几年都把它雪藏了，唉！！！<br>
先写一下版权信息<br>
/*&nbsp;<br>
Theme Name:&nbsp; 这里是模版的名字<br>
Theme URI:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 这里是模版的网址<br>
Version: 1.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 这里是模版的版号<br>
Author:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 这里是作者的名字<br>
Author URI:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 这里是作者的网站<br>
*/<br>
<span id="more-35"></span><br>
现在越来越重视劳动者的权益，所以不得不在文件中声明一下这是哪个人的作品。<br>
其实，只要通过研究别人的作品，至少可以省下一半的力气。<br>
如何来设计一个样式表的思路才是最重要的。<br>
首先要有一个全局观，要学会计算尺寸。你应该清楚，在你的主题模版中，从这里到那里，是属于什么哪一部分的，是要放什么内容进去的。然后你就为这一部分设置它的属性：class与id，当然了，我这里指的是在前面的PHP文件中，为每一个html标签设置的属性。然后我们才可以在样式表文件中具体的来定义这些属性的参数。有一点要注意，上级标签使用了class属性后，它的下级标签中不可再出现id属性。简单一点的说，id可以包含class与id，class不可以包含id.所以说要有一个好的全局观，在为标签的属性命名时才不会出错。</p>
<p>标签的样式定义有着继承性，下级标签会继承上级标签所定义的样式，但是标签也遵循最近原则，例如：<br>
body{color:#000000;}<br>
p{color:#FFFFFF;}&nbsp;<br>
第一行是定义前景色是黑色，标签p的内容也将因继承性而接受是黑色的前景色，但是标签P又定义前景色是白色，这时标签P的内容将遵循最近原则，改变成白色。</p>
<p>在样式表中，一个点代表class，一个#代表id 。<br>
对于有着相同样式的标签，我们可以把它们集合起来简写，用逗号把每个标签分隔开。<br>
例如：P，h1，h2，div，td{font-size:20px;}<br>
还有一种写代码的情况是这样的：<br>
div&nbsp; ul li p{font-size:20px}<br>
每个标签用空格隔开，代表着上下级的关系。这表示一个具体的标签的样式，它是div标签下面的ul标签下面的li标签下面的p标签的内部字体大小，这样的一个定义不会涉及到其它位置的标签。<br>
两个特殊的标签是UL与LI，它们可以互相嵌套，如果定义UL，只会对下一级的UL起作用。而对下一级的LI无效。</p>
]]></content>
	</entry>
		<entry>
		<author>
			<name>无忧</name>
					</author>
		<title type="html"><![CDATA[写给初学者的wordpress 模板制作、修改教程]]></title>
		<link rel="alternate" type="text/html" href="http://www.51eo.com/written-for-beginners-wordpress-templates-to-create-modify-tutorial.html" />
		<id>http://www.51eo.com/written-for-beginners-wordpress-templates-to-create-modify-tutorial.html</id>
		<updated>2008-05-10T10:23:13Z</updated>
		<published>2008-05-10T10:23:13Z</published>
		<category scheme="http://www.51eo.com" term="苍海桑田" />		<summary type="html"><![CDATA[开始之前
在主题目录（C:\xampp\htdocs\wordpress\wp-content\themes）中建立一个新文件夹，如：myThemes。
简介
每一套 WP 主题都由结构层、表现层和数据层构成，可以说是典型的、符合 Web 体系标准的“... ]]></summary>
		<content type="html" xml:base="http://www.51eo.com/written-for-beginners-wordpress-templates-to-create-modify-tutorial.html"><![CDATA[<p align="left"><font style="font-size: 12px">开始之前<br>
在主题目录（C:\xampp\htdocs\wordpress\wp-content\themes）中建立一个新文件夹，如：myThemes。<br>
简介<br>
每一套 WP 主题都由结构层、表现层和数据层构成，可以说是典型的、符合 Web 体系标准的“三层结构”。WP 主题的这种模式块化的特点决定了其设计其实是非常简单，但又极其灵活的。可以说，学会了制作 WP 主题，就相当于基本理解了 Web 开发的客户端模型，对进一步学习掌握 Web 技术具有重要意义。这也正是 WP 的魅力所在！</font> <span class="Ucj974">http://itzoo.cn</span></p>
<p><font style="font-size: 12px">在一套 WP 主题中，最基本的两个文件是 index.php 和 style.css。其中，前者定义结构和内容，后者定义样式。所谓结构，就是由指由 XHTML 标签构成的网页基本架构。在 WP 主题中，结构层主要使用的是添加了适当的 id 或（和）class 属性的 div 和 ul 元素，以便更好地通过表现层来控制页面的布局和外观。所谓表现层，其实就是网页的布局和样式－－也就是外观。表现层由 CSS（级联样式表）规则定义构成。而数据层，顾名思义，也就是网站中实际显示的内容，是通过调用 WP 内置的函数（有时需要传递适当的参数）从数据库中取得的。</font></p>
<p class="Ucj974">http://itzoo.cn</p>
<p><font style="font-size: 12px">说明：为简明起见，本教程不涉及如何定义样式表（CSS）文件的内容。</font> <span class="Ucj974">字串4</span></p>
<p><font style="font-size: 12px">事实上，当我们打开某个主题的文件夹时，看到的并不止这两个文件，而是更多。但一般来说，在一个完整的 WP 主题文件夹中都应该包含下列文件（也称为模板文件）：</font> <font color="#FFFFFF">字串4</font></p>
<p><font style="font-size: 12px">页面 模板文件 用途<br>
首页 index.php 显示网站首页<br>
单页 single.php 显示博文的页面（相当于细节页）<br>
静态页 page.php 显示静态页的页面（包含各级静态页面）<br>
分类页 category.php 显示分类页的页面（相当于栏目页）<br>
存档页 archive.php 显示存档页的页面（相当于按时间归类的栏目页）<br>
搜索页 search.php 显示搜索结果的页面<br>
评论页 comments.php 显示评论的页面<br>
弹出式评论页 comments-popup.php 显示弹出式评论的页面<br>
404错误页 404.php 显示 404 错误信息的页面<br>
级联样式表 style.css 控制页面布局外观</font> <font color="#FFFFFF">http://www.itzoo.cn</font></p>
<p><font style="font-size: 12px">除此之外，一套主题模板中还可以包含 author.php、home.php、date.php、searchform.php 以及 functions.php 等页面（其中部分页面稍后介绍）。</font> <span class="Ucj974">字串5</span></p>
<p><font style="font-size: 12px">虽然上面列出了与 WP 内置功能对应的 9 个 php 文件，但制作一套主题远没有想像得那么复杂。因为事实上，你只需要制作一个 index.php 文件，就可以派生出另外 8 个文件来！</font></p>
<p class="Ucj974">字串4</p>
<p><font style="font-size: 12px">从 WP 应用主题的机制来说，这 9 个模板文件是存在优先级差别的，也可以认为是重要性不同。它们的优先级顺序是：</font> <font color="#FFFFFF">IT动物园</font></p>
<p><font style="font-size: 12px">index.php -&gt; single.php -&gt; page.php -&gt; archive.php -&gt; search.php -&gt; 404.php。</font> <span class="Ucj974">IT动物园</span></p>
<p><font style="font-size: 12px">这样，当不存在后边的页面时，WP 会自动调用前面的页面，直至调用 index.php。比如，当程序调用页面页 page.php 时，如果 page.php 模板文件不存在，那么程序会尝试调用前面的文件－－single.php。而如果 single.php 也不存在，那么就会调用最终的 index.php 来显示页面页。可见 index.php 属于“垫底儿”的缺省页面，它的重要性是最高的。但当存在具体页面时，还是要优先使用具体的页面，可见具体的页面优先级最高。</font> <span class="Ucj974">字串9</span></p>
<p><font style="font-size: 12px">在明确了 index.php 是一套 WP 主题的核心之后，我们就可以将制作 WP 主题的过程简单地分成两步，即－－定义主模板文件 index.php 和派生其他模板文件。</font> <span class="Ucj974">字串7</span></p>
<p><font style="font-size: 12px">定义主模板文件 index.php<br>
从页面布局的角度上，有必要将主模板文件 index.php 拆分成 header.php、sidebar.php 和 footer.php 三个子页面。WP 专门为在 index.php 中包含这三个子页面提供了对应的 get_header()、get_sidebar() 和 get_footer() 函数。</font></p>
<p class="Ucj974">http://itzoo.cn</p>
<p><font style="font-size: 12px">下面，就来详细介绍一下制作 index.php 页面的过程：<br>
首先，在 myThemes 文件夹中建立一个文本文件并将其重命名为 index.php，然后再建立一个 style.css 文件（内容暂时留空）。<br>
然后，用你喜欢的文本编辑器打开 index.php 并输入下列代码（最好复制，因为这一部分不重要）：</font> <span class="Ucj974">http://itzoo.cn</span></p>
<p><font style="font-size: 12px">&lt;!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd“&gt;<br>
&lt;html xmlns=”http://www.w3.org/1999/xhtml“&gt;<br>
&lt;head profile=”http://gmpg.org/xfn/11“&gt;<br>
&lt;meta http-equiv=”Content-Type” content=”&lt;?php bloginfo(’html_type’); ?&gt;;<br>
charset=&lt;?php bloginfo(’charset’); ?&gt;” /&gt;<br>
&lt;title&gt;&lt;?php bloginfo(’name’); ?&gt; &lt;?php if ( is_single() ) { ?&gt; ? Blog Archive &lt;?php } ?&gt;<br>
&lt;?php wp_title(); ?&gt;&lt;/title&gt;<br>
&lt;meta name=”generator” content=”WordPress &lt;?php bloginfo(’version’); ?&gt;” /&gt;<br>
&lt;!– leave this for stats –&gt;<br>
&lt;link rel=”stylesheet” href=”&lt;?php bloginfo(’stylesheet_url’); ?&gt;”<br>
type=”text/css” media=”all” /&gt; <span class="Ucj974">http://itzoo.cn</span><br>
&lt;link rel=”stylesheet” href=”&lt;?php bloginfo(’stylesheet_directory’); ?&gt;<br>
/print.css” type=”text/css” media=”print” /&gt;<br>
&lt;link rel=”alternate” type=”application/rss+xml” title=”&lt;?php bloginfo(’name’); ?&gt;<br>
<font size="3">RSS Feed” href=”&lt;?php bloginfo(’rss2_url’); ?&gt;”/&gt;<br>
&lt;link rel=”pingback” href=”&lt;?php bloginfo(’pingback_url’); ?&gt;” /&gt;<br>
&lt;?php wp_head(); ?&gt;<br>
&lt;/head&gt;<br>
&lt;body&gt;<br>
&lt;/body&gt;<br>
&lt;/html&gt;</font> <font color="#FFFFFF">字串8</font></font></p>
<p><font style="font-size: 12px">显然，这是一些构成网页文件的 HTML 代码，当然其中包含 PHP 代码。如前所述，HTML 代码定义结构，而 PHP 代码用于生成内容。</font></p>
<p class="Qlw852">http://itzoo.cn</p>
<p><font style="font-size: 12px">在 WP 后台的“主题”模块中，选择 myTheme 主题。然后，在浏览器中观察你的 WP 外观。此时，应该显示页面一片空白。但通过“查看源文件”，你会发现 index.php 中的 PHP 代码已经生成了一些头部内容。</font> <font color="#FFFFFF">字串4</font></p>
<p><font style="font-size: 12px">接着，我们开始动手定义 index.php 中 body 部分的结构和内容。</font> <span class="Qlw852">字串5</span></p>
<p><font style="font-size: 12px">（一）构建 header<br>
在 body 元素内，新建如下结构化标记元素，注意各元素都带有不同的 id 属性：</font> <font color="#FFFFFF">字串4</font></p>
<p><font style="font-size: 12px">&lt;div id=”page”&gt;<br>
&lt;div id=”header”&gt;&lt;/div&gt;<br>
&lt;div id=”content”&gt;&lt;/div&gt;<br>
&lt;div id=”sidebar”&gt;&lt;/div&gt;<br>
&lt;div id=”footer”&gt;&lt;/div&gt;<br>
&lt;/div&gt;</font> <span class="Qlw852">IT动物园</span></p>
<p><font style="font-size: 12px">然后，在该 &lt;div id=”header”&gt;&lt;/div&gt; 元素的两个标签之间输入下列代码：</font></p>
<p class="Qlw852">http://www.itzoo.cn</p>
<p><font style="font-size: 12px">&lt;h1&gt;&lt;a href=”&lt;?php bloginfo(’url’); ?&gt;” title=”&lt;?php bloginfo(’name’); ?&gt;”&gt;&lt;?php bloginfo(’name’); ?&gt;&lt;/a&gt;&lt;/h1&gt;<br>
&lt;p&gt;&lt;?php bloginfo(’description’); ?&gt;&lt;/p&gt;</font></p>
<p class="Qlw852">字串8</p>
<p><font style="font-size: 12px">这里用到了 WP 内置的 bloginfo 函数来生成内容，其中：</font> <font color="#FFFFFF">IT动物园</font></p>
<p><font style="font-size: 12px">bloginfo(’url’)返回网站主页链接；<br>
bloginfo(’name’)返回网站标题；<br>
bloginfo(’description’)返回网站描述。<br>
保存 index.php 文件，然后在浏览器中按 F5 刷新一下页面，看能看到什么？再通过“查看源文件”，核对一下由 WP 的 bloginfo() 函数生成的相关信息。</font> <span class="Qlw852">字串5</span></p>
<p><font style="font-size: 12px">（二）构建 content<br>
在 &lt;div id=”content”&gt;&lt;/div&gt; 中，我们要通过循环显示博文，包括每个博文的标题、作者、发表日期以及其他相关信息。并且，可以分页显示博文（取决于 WP 后台的设置）。<br>
首先，在 &lt;div id=”content”&gt; 与 &lt;/div&gt; 之间输入下列代码：</font> <span class="Qlw852">字串4</span></p>
<p><font style="font-size: 12px">&lt;?php while (have_posts()) : the_post(); ?&gt; &lt;div class=”post” id=”post-&lt;?php the_ID() ?&gt;”&gt;<br>
&lt;!– 博文标题及链接 –&gt;<br>
&lt;h2&gt;&lt;a href=”&lt;?php the_permalink() ?&gt;” rel=”bookmark” title=”&lt;?php the_title(); ?&gt;”&gt;<br>
&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h2&gt;<br>
&lt;!– 发表日期 –&gt;<br>
&lt;div class=”post-date”&gt;<br>
&lt;span class=”post-month”&gt;&lt;?php the_time(’M’) ?&gt;&lt;/span&gt;<br>
&lt;span class=”post-day”&gt;&lt;?php the_time(’d’) ?&gt;&lt;/span&gt;<br>
&lt;/div&gt;<br>
&lt;!– 作者 –&gt;<br>
&lt;span class=”post-author”&gt;&lt;?php _e(’Author’); ?&gt;：&lt;?php the_author(’, ‘) ?&gt;&lt;/span&gt;<br>
&lt;!– 类别 –&gt;<br>
&lt;span class=”post-cat”&gt;&lt;?php _e(’Categories’); ?&gt;：&lt;?php the_category(’, ‘) ?&gt;&lt;/span&gt;</font></p>
<p class="Qlw852">字串9</p>
<p>&lt;!– 注释 –&gt;<br>
&lt;span class=”post-comments”&gt;<br>
&lt;?php comments_popup_link(’No Comments ?’, ‘1 Comment ?’, ‘% Comments ?’); ?&gt;&lt;/span&gt;<br>
&lt;!– 内容 –&gt;<br>
&lt;div class=”entry”&gt;<br>
&lt;?php the_content(’更多内容 ?’); ?&gt;<br>
&lt;/div&gt;<br>
&lt;!– 其他元（Meta）数据 –&gt;<br>
&lt;div class=”post-meta”&gt;<br>
&lt;?php edit_post_link(’编辑’,’ | ‘,”); ?&gt;<br>
&lt;/div&gt; &lt;/div&gt;<br>
&lt;?php endwhile; ?&gt;&lt;div class=”navigation”&gt;<br>
&lt;span class=”previous-entries”&gt;&lt;?php next_posts_link(’前一篇’) ?&gt;&lt;/span&gt; &lt;span class=”next-entries”&gt;&lt;?php previous_posts_link(’后一篇’) ?&gt;&lt;/span&gt;<br>
&lt;/div&gt;<br>
&lt;?php else : ?&gt;<br>
&lt;div class=”post”&gt;<br>
&lt;h2&gt;&lt;?php _e(’Not Found’); ?&gt;&lt;/h2&gt;</p>
<p class="Qlw852">http://www.itzoo.cn</p>
<p>&lt;/div&gt;&lt;?php endif; ?&gt; <font size="3"><font color="#FFFFFF">http://www.itzoo.cn</font></font></p>
<p><font style="font-size: 12px">看似复杂，其实不然。首先：</font> <font color="#FFFFFF">http://www.itzoo.cn</font></p>
<p><font style="font-size: 12px">&lt;?php if (have_posts()) : ?&gt;<br>
&lt;?php else : ?&gt;<br>
&lt;?php endif; ?&gt;</font></p>
<p class="Qlw852">字串4</p>
<p><font style="font-size: 12px">这三行，在 WP 中表示 if 控制结果。注意，if 语句通过测试 have_posts() 函数来测试是否存在博文。而</font></p>
<p class="Qlw852">字串6</p>
<p><font style="font-size: 12px">&lt;?php while (have_posts()) : the_post(); ?&gt;<br>
&lt;?php endwhile; ?&gt;</font></p>
<p><font style="font-size: 12px">这两行，是 WP 中的 while 循环。其中，while 语句通过测试 have_posts() 决定是否调用 the_post() 函数。如果测试 have_posts() 返回 true，则调用 the_post() 函数，初始化与博文相关的内置变量。<br>
在 while 循环内部，首先要注意通过 div、h2、span 这三个元素定义的嵌套语义结构，以及相应元素的 class 和 id 属性（其中只为 class 为 post 的 div 元素定义了一个 id 属性－－post-&lt;?php the_ID() ?&gt;）。这是将来使用 CSS 控制外观的关键所在。在这个 div 元素中，为显示博文的相关信息，分别调用了以下 WP 函数：</font> <font color="#FFFFFF">字串9</font></p>
<p><font style="font-size: 12px">the_ID()：返回博文 ID；<br>
the_permalink()：返回博文固定链接 URL；<br>
the_title()：返回博文标题；<br>
the_time(’M’)：返回发表日期中的月份；<br>
the_time(’d’)：返回发表日期中的天；<br>
the_author()：返回博文作者；<br>
the_category()：返回博文的类别；<br>
the_content()：返回博文的内容，其中的参数表示用于“更多内容”的链接文本；<br>
以上函数都是以 the_ 开头的，加上后面的函数名不仅颇有自解释的味道，而且令人联想到 this 关键字。此外<br>
_e() 函数是一个包装函数，这个函数主要用于语言的转换，如果调用该函数并传递标准的 WP 术语，如：Author 或 Categories，则返回你相应语言包中的译文，在中文包中分别是“作者”和“类别”。当然，不用也可。但会失去一些适应性。<br>
还有，omments_popup_link() 和 edit_post_link() 两个函数，分别显示注释和编辑链接，这里不多说了。<br>
另外，在 &lt;?php endwhile; ?&gt; 后面显示了分页导航链接，调用的函数分别是：next_posts_link() 和 previous_posts_link()。此时，如果你的博文总数小于 WP 后台设置的最多显示数目，比如：你在后台设置最多显示 5 篇，而你有 10 篇博文，就会分页显示；否则，如果你的博文少于或等于 5 篇则看不到分页导航链接。 <font color="#FFFFFF">字串4</font><br>
最后，不要丢下 &lt;?php else : ?&gt; 语句后面的内容：</font></p>
<p class="Hij956">http://itzoo.cn</p>
<p><font style="font-size: 12px">&lt;div class=”post”&gt;<br>
&lt;h2&gt;&lt;?php _e(’Not Found’); ?&gt;&lt;/h2&gt;<br>
&lt;/div&gt;</font></p>
<p class="Hij956">字串8</p>
<p><font style="font-size: 12px">显然，这是一个错误提示信息。</font> <font color="#FFFFFF">字串4</font></p>
<p><font style="font-size: 12px">（三）构建 sidebar<br>
sidebar 的内容当然要在 &lt;div id=”sidebar”&gt;&lt;/div&gt; 元素中构建了。sidebar，中文叫侧边栏，其中可以包含很多内容。比如：分类、页面、链接、日历等等导航及相关信息。<br>
在 WP 中，sidebar 中的内容都以无序（ul）或有序（ol）列表的形式输出。因此，需要在 &lt;div id=”sidebar”&gt;&lt;/div&gt; 中输入以下标记：</font></p>
<p class="Hij956">http://itzoo.cn</p>
<p><font style="font-size: 12px">&lt;ul&gt;<br>
&lt;?php if ( !function_exists(’dynamic_sidebar’) || !dynamic_sidebar() ) : ?&gt;<br>
&lt;li id=”search”&gt;<br>
&lt;?php include(TEMPLATEPATH .’/searchform.php’); ?&gt;<br>
&lt;/li&gt; &lt;li id=”calendar”&gt;<br>
&lt;h2&gt;&lt;?php _e(’Calendar’); ?&gt;&lt;/h2&gt;<br>
&lt;?php get_calendar(); ?&gt;<br>
&lt;/li&gt; &lt;?php wp_list_pages(’title_li=&lt;h2&gt;页面&lt;/h2&gt;’); ?&gt; &lt;li class=”catnav”&gt;<br>
&lt;h2&gt;&lt;?php _e(’Categories’); ?&gt;&lt;/h2&gt;<br>
&lt;ul&gt;<br>
&lt;?php wp_list_cats(’sort_column=name&amp;optioncount=1&amp;hierarchical=0′); ?&gt;<br>
&lt;/ul&gt;<br>
&lt;/li&gt;<br>
&lt;li class=”archivesnav”&gt;<br>
&lt;h2&gt;&lt;?php _e(’Archives’); ?&gt;&lt;/h2&gt;<br>
&lt;ul&gt;<br>
&lt;?php wp_get_archives(’type=monthly’); ?&gt;<br>
&lt;/ul&gt;<br>
&lt;/li&gt;<br>
&lt;li class=”blogrollnav”&gt;</font></p>
<p class="Hij956">字串5</p>
<p>&lt;h2&gt;&lt;?php _e(’Links’); ?&gt;&lt;/h2&gt;<br>
&lt;ul&gt;<br>
&lt;?php get_links(’-1′, ‘&lt;li&gt;’, ‘&lt;/li&gt;’, ‘&lt;br /&gt;’, FALSE, ‘id’, FALSE, FALSE, -1, FALSE); ?&gt;<br>
&lt;/ul&gt;<br>
&lt;/li&gt;<br>
&lt;li class=”meta”&gt;<br>
&lt;h2&gt;&lt;?php _e(’Meta’); ?&gt;&lt;/h2&gt;<br>
&lt;ul&gt;&lt;?php wp_register(); ?&gt;&lt;li&gt;&lt;?php wp_loginout(); ?&gt;&lt;/li&gt;<br>
&lt;?php wp_meta(); ?&gt;&lt;/ul&gt;<br>
&lt;/li&gt;<br>
&lt;?php endif ?&gt;<br>
&lt;/ul&gt; 以上代码从第三行开始，分别通过包含 searchform.php 显示搜索表单； <font size="3"><span class="Hij956">IT动物园</span></font></p>
<p><font style="font-size: 12px">调用 get_calendar() 函数显示日历；<br>
调用 wp_list_pages() 函数显示页面导航；<br>
调用 wp_list_cats() 函数显示分类导航；<br>
调用 wp_get_archives() 函数显示存档导航；<br>
调用 get_links() 函数显示链接导航。<br>
在构建侧边栏时，要为生成搜索框新建一个 searchform.php 文件，其内容如下：</font></p>
<p class="Hij956">字串7</p>
<p><font style="font-size: 12px">&lt;form method=”get” id=”searchform” action=”&lt;?php bloginfo(’home’); ?&gt;/”&gt;<br>
&lt;div&gt;<br>
&lt;input type=”text” value=”&lt;?php echo wp_specialchars($s, 1); ?&gt;” name=”s” id=”s” size=”15″ /&gt;&lt;br /&gt;<br>
&lt;input type=”submit” id=”searchsubmit” value=”Search” /&gt;<br>
&lt;/div&gt;<br>
&lt;/form&gt;</font> <font color="#FFFFFF">字串5</font></p>
<p><font style="font-size: 12px">将其保存在 myTheme 文件夹中，通过 include 语句包含进来就可以了。注意，常量 TEMPLATEPATH 中保存的是模板路径。<br>
最后，说明一下以上代码第二行和倒数第二行。显然这是一个 if 语句块。那这个 if 语句块包含 sidebar 是何用意呢？这是部件化侧边栏的需要，就是让 sidebar 适合 Widget 插件（WP 2.0 后内置了 Widget，所以不用再安装了）。如果要使用 Widget 插件，必须对 sidebar 进行部件化。这样，在 WP 后台通过 Widget 插件你就可以使用拖动来方便地定义侧边栏的组件了。部件化侧边栏，除了在 ul 元素内侧放入这个 if 语句之外，还必须在 myTheme 文件夹中建立一个文件 functions.php，其内容如下：</font> <span class="Yrs646">http://itzoo.cn</span></p>
<p><font style="font-size: 12px">&lt;?php<br>
if ( function_exists(’register_sidebar’) )<br>
register_sidebar(array(<br>
‘before_widget’ =&gt; ‘&lt;li id=”%1$s” class=”widget %2$s”&gt;’,<br>
‘after_widget’ =&gt; ‘&lt;/li&gt;’,<br>
‘before_title’ =&gt; ‘&lt;h2 class=”sidebartitle”&gt;’,<br>
‘after_title’ =&gt; ‘&lt;/h2&gt;’,<br>
));<br>
?&gt;</font> <font color="#FFFFFF">字串8</font></p>
<p><font style="font-size: 12px">（四）构建 footer<br>
footer 中一般都一些版权信息和不太重要的链接。所以可以在 &lt;div id=”footer”&gt;&lt;/div&gt; 元素中简单地放入下列代码：</font></p>
<p class="Yrs646">IT动物园</p>
<p><font style="font-size: 12px">&lt;p&gt;Copyright ? 2007 &lt;?php bloginfo(’name’); ?&gt;&lt;/p&gt;</font> <font color="#FFFFFF">IT动物园</font></p>
<p><font style="font-size: 12px">至此，核心 index.php 文件就算是大功告成了！</font></p>
<p class="Yrs646">字串5</p>
<p><font style="font-size: 12px">接下来，是拆分 index.php 和基于 index.php 派生子模板文件。</font></p>
<p class="Yrs646">字串8</p>
<p><font style="font-size: 12px">在 myTheme 文件夹中新建 header.php、sidebar.php 和 footer.php 三个文件。把 index.php 中的 &lt;div id=”header”&gt;&lt;/div&gt;、&lt;div id=”sidebar”&gt;&lt;/div&gt; 和 &lt;div id=”footer”&gt;&lt;/div&gt; 三个结构化元素及其内容分别转移（剪切）到这三个新文件中。然后，在 &lt;div id=”header”&gt;&lt;/div&gt; 原来的位置处输入代码：</font> <font color="#FFFFFF">字串8</font></p>
<p><font style="font-size: 12px">&lt;?php get_header();?&gt;</font></p>
<p class="Yrs646">字串7</p>
<p><font style="font-size: 12px">在 &lt;div id=”sidebar”&gt;&lt;/div&gt; 原来的位置处输入代码：</font></p>
<p class="Yrs646">字串7</p>
<p><font style="font-size: 12px">&lt;?php get_sidebar();?&gt;</font> <font color="#FFFFFF">http://www.itzoo.cn</font></p>
<p><font style="font-size: 12px">在 &lt;div id=”footer”&gt;&lt;/div&gt; 原来的位置处输入代码：</font> <font color="#FFFFFF">http://itzoo.cn</font></p>
<p><font style="font-size: 12px">&lt;?php get_footer();?&gt;</font></p>
<p class="Yrs646">字串8</p>
<p><font style="font-size: 12px">前面说过，这三个 get 函数是 WP 专门为包含结构化的文件定义的。现在你的 index.php 文件应该如下所示：</font></p>
<p class="Yrs646">字串4</p>
<p><font style="font-size: 12px">&lt;!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd“&gt;<br>
&lt;html xmlns=”http://www.w3.org/1999/xhtml“&gt;&lt;head profile=”http://gmpg.org/xfn/11“&gt;<br>
&lt;meta http-equiv=”Content-Type” content=”&lt;?php bloginfo(’html_type’); ?&gt;; charset=&lt;?php bloginfo(’charset’); ?&gt;” /&gt;&lt;title&gt;&lt;?php bloginfo(’name’); ?&gt; &lt;?php if ( is_single() ) { ?&gt; ? Blog Archive &lt;?php } ?&gt; &lt;?php wp_title(); ?&gt;&lt;/title&gt;&lt;meta name=”generator” content=”WordPress &lt;?php bloginfo(’version’); ?&gt;” /&gt; &lt;!– leave this for stats –&gt;&lt;link rel=”stylesheet” href=”&lt;?php bloginfo(’stylesheet_url’); ?&gt;” type=”text/css” media=”all” /&gt;<br>
&lt;link rel=”stylesheet” href=”&lt;?php bloginfo(’stylesheet_directory’); ?&gt;/print.css” type=”text/css” media=”print” /&gt; <span class="Yrs646">http://www.itzoo.cn</span><br>
&lt;link rel=”alternate” type=”application/rss+xml” title=”&lt;?php bloginfo(’name’); ?&gt; RSS Feed” href=”&lt;?php bloginfo(’rss2_url’); ?&gt;” /&gt;<br>
&lt;link rel=”pingback” href=”&lt;?php bloginfo(’pingback_url’); ?&gt;” /&gt;&lt;?php wp_head(); ?&gt;<br>
&lt;/head&gt;<br>
&lt;body&gt;<br>
&lt;div id=”page”&gt;&lt;?php get_header(); ?&gt; &lt;!– content –&gt;<br>
&lt;div id=”content”&gt;<br>
&lt;?php if (have_posts()) : ?&gt;<br>
&lt;?php while (have_posts()) : the_post(); ?&gt; &lt;div class=”post” id=”post-&lt;?php the_ID() ?&gt;”&gt;<br>
&lt;!– 博文标题及链接 –&gt;<br>
&lt;h2&gt;&lt;a href=”&lt;?php the_permalink() ?&gt;” rel=”bookmark” title=”&lt;?php the_title(); ?&gt;”&gt;<br>
&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h2&gt;<br>
&lt;!– 发表日期 –&gt;<br>
&lt;div class=”post-date”&gt; <font color="#FFFFFF">字串5</font><br>
&lt;span class=”post-month”&gt;&lt;?php the_time(’M’) ?&gt;&lt;/span&gt;<br>
&lt;span class=”post-day”&gt;&lt;?php the_time(’d’) ?&gt;&lt;/span&gt;<br>
&lt;/div&gt;<br>
&lt;!– 作者 –&gt;<br>
&lt;span class=”post-author”&gt;&lt;?php _e(’Author’); ?&gt;：&lt;?php the_author(’, ‘) ?&gt;&lt;/span&gt;<br>
&lt;!– 类别 –&gt;<br>
&lt;span class=”post-cat”&gt;&lt;?php _e(’Categories’); ?&gt;：&lt;?php the_category(’, ‘) ?&gt;&lt;/span&gt;<br>
&lt;!– 注释 –&gt;<br>
&lt;span class=”post-comments”&gt;<br>
&lt;?php comments_popup_link(’No Comments ?’, ‘1 Comment ?’, ‘% Comments ?’); ?&gt;&lt;/span&gt;<br>
&lt;!– 内容 –&gt;<br>
&lt;div class=”entry”&gt;<br>
&lt;?php the_content(’更多内容 ?’); ?&gt;<br>
&lt;/div&gt;<br>
&lt;!– 其他元（Meta）数据 –&gt;<br>
&lt;div class=”post-meta”&gt;<br>
&lt;?php edit_post_link(’编辑’,’ | ‘,”); ?&gt;<br>
&lt;/div&gt; &lt;/div&gt;<br>
&lt;?php endwhile; ?&gt; &lt;div class=”navigation”&gt;<br>
&lt;span class=”previous-entries”&gt;&lt;?php next_posts_link(’前一篇’) ?&gt;&lt;/span&gt; &lt;span class=”next-entries”&gt;&lt;?php previous_posts_link(’后一篇’) ?&gt;&lt;/span&gt;</font></p>
<p class="Gyl337">字串8</p>
<p>&lt;/div&gt;<br>
&lt;?php else : ?&gt;<br>
&lt;div class=”post”&gt;<br>
&lt;h2&gt;&lt;?php _e(’Not Found’); ?&gt;&lt;/h2&gt;<br>
&lt;/div&gt;&lt;?php endif; ?&gt;<br>
&lt;/div&gt;&lt;!– end content –&gt;&lt;?php get_sidebar(); ?&gt; &lt;?php get_footer(); ?&gt;&lt;/div&gt;<br>
&lt;/body&gt;<br>
&lt;/html&gt; <span class="Gyl337">IT动物园</span></p>
<p><font style="font-size: 12px">然后，是派生子模板文件。把这个“模块化”的 index.php 文件另存为 single.php、page.php、archive.php、 search.php 和 category.php。当然，都保存在 myTheme 文件夹中。这样，WP 在显示页面时就会调用相应的页面文件了。比如，显示博文详细内容时，会调用 single.php；而显示页面内容时，则调用 page.php。<br>
最后，要做的工作就是自定义这些子模板文件。<br></font></p>
]]></content>
	</entry>
		<entry>
		<author>
			<name>无忧</name>
					</author>
		<title type="html"><![CDATA[WordPress 搜索引擎优化的方法]]></title>
		<link rel="alternate" type="text/html" href="http://www.51eo.com/wordpress-search-engine-optimization-methods.html" />
		<id>http://www.51eo.com/wordpress-%e6%90%9c%e7%b4%a2%e5%bc%95%e6%93%8e%e4%bc%98%e5%8c%96%e7%9a%84%e6%96%b9%e6%b3%95.html</id>
		<updated>2008-05-10T10:12:56Z</updated>
		<published>2008-05-09T10:12:06Z</published>
		<category scheme="http://www.51eo.com" term="锦瑟流年" />		<summary type="html"><![CDATA[为了总结 SEO WordPress 的方法，前些天做了很多准备工作，收集相关文章和工具。而这篇文章主要参照了“SEO for WordPress”和“WordPress and SEO”这 2 篇文章，另外还参考了“Google 搜索引擎优化技术... ]]></summary>
		<content type="html" xml:base="http://www.51eo.com/wordpress-search-engine-optimization-methods.html"><![CDATA[<p>为了总结 SEO WordPress 的方法，前些天做了很多准备工作，收集相关文章和工具。而这篇文章主要参照了“SEO for WordPress”和“WordPress and SEO”这 2 篇文章，另外还参考了“Google 搜索引擎优化技术的12个要点”，我要做的就是把他们的方法用自己的语言归纳了一下，然后加入一点自己的看法。</p>
<p>SEO WordPress 首先就要选一个好主题 (注意：在 WP 主题中普遍存在的 6 个 SEO 问题)，当然现在市面上的 WordPress 主题都是按照 Web 标准来设计制作的，对搜索引擎已经够友好了，而 WordPress 本身就很适合 SEO，下面就来说说优化过程。</p>
<p>1、设置一个友好链接</p>
<p>这里介绍了很多种 Permalinks 结构，对个人博客 Jim 推荐最好的结构是 /%postname%/ ，而我认为 /%year%/%monthnum%/%postname%.html 这种结构更加合理。</p>
<p>2、让 WordPress 的 URL 地址唯一化</p>
<p>在使用了 Permalinks 后、URL 结束 “/” 标签问题、WWW问题，都会导致一篇文章会出现多个地址，这样对搜索引擎是很不友好的。我们需要利用一些方法来改善这些问题，让你的 WordPress 的 URL 规范化。</p>
<p>3、合理设置一个 robots.txt</p>
<p>在站点下放置一个 robots.txt 带来的好处很多，有文章说通过将 comment feeds 与 Trackbacks 排除在外，网站访问量上升了11.3%，在 WordPress 下我们可以这样设置。</p>
<p>4、关于 Meta 内容</p>
<p>有很多关于设置 Meta 的 WordPrss 插件，如：Head META Description、HeadSpace 2、Add Your Own Headers，但 Jim 却不推荐这么做，因为 Keywords 属性目前在 Pagerank 的计算中已经不再使用了（或者极少使用），只是对其他搜索引擎的排名还有一定的作用，没有必要为了它而多安装一个插件。</p>
<p>description 属性应该还是有用的，为了提高排名，可以适当在里面提高关键词的密度，还可以使用 Head META Description 这个插件把文章内容截取到 description 里面。</p>
<p>2个有代表性的插件</p>
<p>HeadSpace 这个插件功能多得有点变态，不但可以单独设置首页、内容页、归档页、分类页等这些页面的 description/keywords/title 属性，还可以单独为它们定义一个主题，也可以在写文章的时候对每篇文章加入以上属性。</p>
<p>Add Your Own Headers 可以优化的你 title 页标题，自动把博客名字放在标题后面并加上分割符，可以把分类自动添加到 keywords 中。</p>
<p>而我的意见是没有必要这么做，最多开启 Ultimate Tag Warrior 插件自带的“Include meta keywords“选项，把 Tag 加入到 meta 中。就像 Matt，根本没有在 meta 中设置 keywords 和 description 属性，优化文章标题和内容更为重要。</p>
<p>5、优化 title（页标题）内容</p>
<p>title（页标题）是最重要的HTML标签，SEOmoz 的一篇文章说到，在页标题中最好带有网站名称和一些关键词、长度不超过32个中文字、不要放置没有关联的关键词、使用分割符，可以是 “|”（竖线）“-”（中划线）“«” “»”、还可以在文章内容中用 H1 来重复一次页标题内容。</p>
<p>也可以参考 Matt 和 jeffrey 他们的结构，比较有权威性。</p>
<p>6、文章标题 (Headings) 二级标题、三级标题的使用</p>
<p>搜索引擎把（h1,h2,h3…）看得比其他内容（p,li…）都重要，所以写一个好的带有关键词的文章标题很重要，每个页面的标题都要不同，并且要与自身网页的内容相符，每个页面的标题最好只重点突出 1-2 个关键词，不要太多。建议看看这篇阿宏翻译的《定义标题的最好方法》，就可以对（h1,h2,h3…）有一个更深刻的认识。</p>
<p>7、建立一个合理的导航结构</p>
<p>1）导航清晰明了，方便用户浏览，无论页面多深，都有回到首页的链接;<br>
2）把一些重要的文章链接到首页；<br>
3）也可以链接你以前写过的文章（我这篇文章就链接了很多以前写的文章）；<br>
4）不要在首页放很多外部链接，最好放在单独的一页；<br>
5）链接最好不要使用 Flash 和图片按钮，而是文本;<br>
6）安装 Related Posts 插件，可以带领你的读者深入阅读；<br>
7）安装 Ultimate Tag Warrior 插件，可以很好地为你的读者提供导航。<br>
8）可以安装 Landing sites 提高网站粘合度；</p>
<p>8、是否移除链接上的 nofollow 属性</p>
<p>是否移除 rel=”nofollow” 有很大的争论，但有一点要明白，如果你真的想删除评论链接上的 nofollow 属性，就得把好审核关，不能让 404 错误链接、色情、赌博和被处罚的网站链接出现在你的网页中。（摘自： 如果没有“NoFollow”……）；</p>
<p>9、建立一个 Site Map（站点地图）</p>
<p>站点地图有2个作用，一个是给来访者看的，可以带他们在你的博客上找到想要的文章，这个站点地图链接了所有的页面，所有的网页上都有一个链接指向这个站点地图，内容要小于100K；另外一个是给搜索引擎准备的，推荐安装 Google Sitemaps Generator 这个插件，然后用 Tags Addon Plugin 把 UTW Tag 也加入到 Sitemap 中。</p>
<p>10、页面的设计</p>
<p>一个页面的设计如何对搜索引擎作用不大，也可能不属于 SEO 的范畴，但它对用户体验非常重要。所以页面最好保持简单的设计，使用有大而清晰的标题文字，设置合适的文字间距，这里推荐几款主题 Simpla Theme、Tarski、SEO Adsense Wordpress Theme、AdSense Wordpress Theme。</p>
<p>11、关键词的使用</p>
<p>1）关键词应该出现在 title（页标题）标签里面；<br>
2）在 URL 里面包含关键词；<br>
3）在网页导出链接的链接文字中包含关键词；<br>
4）用粗体显示关键词；<br>
5）在文章标题中提及该关键词（一致认为 h1 标签比 h2, h3 的影响效果更好）；<br>
6）图像 alt 标签可以放入关键词；<br>
7）整个文章中都要包含关键词，但最好在第一段第一句话就放入；<br>
8）在元标签（meta）中放入关键词，虽然它的作用越来越小。</p>
<p>摘录自：Blog的搜索引擎优化</p>
<p>12、CSS</p>
<p>据说，在 html 代码中把有用的内容放在前面，有利于提高 rank 值。例如导航栏或侧边栏看起来在文章内容的左边，实际在 html 源代码中中却放在最后，然后通 CSS 来定位它的显示位置。无论这个说法有没有道理，但是做了总比没做好。</p>
<p>可以在 Firefox 的 “查看 - 页面风格”这里选择“无风格”，查看没有 CSS 的页面效果。</p>
<p>13、文章内容和反向链接</p>
<p>怎样做好高质量的内容，有很多这方面的文章，SEOmoz 写道，一个非常优秀的文章好过 1000 个好文章，一个好文章修改 10 次比写 10 个一般文章好。这点在柠檬的博客上得到了见证，他写的文章不多，但那几个主题拥有的大量反向链接，所以知名度和 Pagerank 都很高。反向链接数的多少就能证明你这篇文章的质量，没人会链接一个垃圾页面到他的网站。还有就是你的文章一定得原创，而且内容简洁有力，一般情况下没人会看你的长篇大论。</p>
<p>这可能也不属于 SEO 的东西，但却是写一个博客必须要注意的。</p>
<p>Jim 推荐了一个他自己的插件“Link to Me Textbox”，可以让别人快速链接你的文章。我每次链接别人的文章的时候，都要复制 2 次，一次是标题，一次是地址（如果你使用可视化编辑器就另当别论了）。</p>
]]></content>
	</entry>
		<entry>
		<author>
			<name>无忧</name>
					</author>
		<title type="html"><![CDATA[能给管理员发送email的404错误页]]></title>
		<link rel="alternate" type="text/html" href="http://www.51eo.com/administrators-can-send-a-404-page-email.html" />
		<id>http://www.51eo.com/%e8%83%bd%e7%bb%99%e7%ae%a1%e7%90%86%e5%91%98%e5%8f%91%e9%80%81email%e7%9a%84404%e9%94%99%e8%af%af%e9%a1%b5.html</id>
		<updated>2008-05-10T10:13:28Z</updated>
		<published>2008-05-09T10:05:35Z</published>
		<category scheme="http://www.51eo.com" term="依网情深" />		<summary type="html"><![CDATA[代码如下：
&#60;?
$domain = “your.domain.com”;
$docroot = “http://your.domain.com“;
$fontface = “Verdana”;
$fontsize = “2″;
$bgcolor = “#ffffff”;
$textcolor = “#000000″;
$reportlevel = 2;
$emailaddress = “you@your.domain.co... ]]></summary>
		<content type="html" xml:base="http://www.51eo.com/administrators-can-send-a-404-page-email.html"><![CDATA[<p>代码如下：</p>
<p>&lt;?<br>
$domain = “your.domain.com”;<br>
$docroot = “<a href="http://your.domain.com/">http://your.domain.com</a>“;<br>
$fontface = “Verdana”;<br>
$fontsize = “2″;<br>
$bgcolor = “#ffffff”;<br>
$textcolor = “#000000″;<br>
$reportlevel = 2;<br>
$emailaddress = “<a href="mailto:you@your.domain.com">you@your.domain.com</a>“;<br>
function print_details()<br>
{<br>
global $fontface, $fontsize, $docroot, $REQUEST_URI, $reportlevel;<br>
global $bgcolor, $textcolor<br>
echo “&lt;html&gt;&lt;head&gt;&lt;title&gt;404 Not Found&lt;/title&gt;&lt;/head&gt;”;<br>
echo “&lt;body bgcolor=\”$bgcolor\” text=\”$textcolor\”&gt;”;<br>
echo “&lt;b&gt;&lt;h1&gt;404 Not Found&lt;/h1&gt;&lt;/b&gt;”;<br>
echo “&lt;p&gt;&lt;font face=\”$fontface\” size=\”$fontsize\”&gt;”;<br>
echo “We’re sorry. The page you requested, $docroot$REQUEST_URI, doesn’t exist”;<br>
echo ” on this server.&lt;/font&gt;&lt;/p&gt;”;<br>
if ($reportlevel != 0)<br>
{<br>
echo “&lt;p&gt;&lt;font face=\”$fontface\” size=\”$fontsize\”&gt;”;<br>
echo “The details of this error have automatically been mailed to the webmaster.”;<br>
}<br>
return;<br>
}</p>
<p>function send_email()<br>
{<br>
global $REQUEST_URI, $HTTP_REFERER, $emailaddress, $REMOTE_ADDR, $docroot;<br>
$today = getdate();<br>
$month = $today[mon];<br>
$mday = $today[mday];<br>
$year = $today[year];<br>
$hours = $today[hours];<br>
$minutes = $today[minutes];<br>
$errortime = “$month/$mday/$year at $hours:$minutes”;<br>
$message .= “404 Error Report\n\nA 404 error was encountered by $REMOTE_ADDR”;<br>
$message .= ” on $errortime.\n\n”;<br>
$message .= “The URI which generated the error is: \n$docroot$REQUEST_URI\n\n”;<br>
$message .= “The referring page was:\n$HTTP_REFERER\n\n”;</p>
<p>mail(”$emailaddress”, “404 Error Report”, $message, “From: $emailaddress”);</p>
<p>return;<br>
}</p>
<p>print_details();</p>
<p>if ($reportlevel != 0)<br>
if ($reportlevel == 1) {<br>
if (eregi($domain,$HTTP_REFERER))<br>
send_email(); }<br>
else<br>
send_email();</p>
<p>exit;</p>
<p>?&gt;</p>
]]></content>
	</entry>
		<entry>
		<author>
			<name>无忧</name>
					</author>
		<title type="html"><![CDATA[我的个人博客开张啦!]]></title>
		<link rel="alternate" type="text/html" href="http://www.51eo.com/the-heros-tears-were-the-sacred-flame-lit.html" />
		<id>http://www.51eo.com/%e8%8b%b1%e9%9b%84%e7%9a%84%e7%9c%bc%e6%b3%aa%e8%a2%ab%e5%9c%a3%e7%81%ab%e7%85%a7%e4%ba%ae.html</id>
		<updated>2008-05-10T14:40:38Z</updated>
		<published>2008-05-09T08:34:10Z</published>
		<category scheme="http://www.51eo.com" term="锦瑟流年" />		<summary type="html"><![CDATA[公元2008年05月9日下午，我的博客终于成功开张!... ]]></summary>
		<content type="html" xml:base="http://www.51eo.com/the-heros-tears-were-the-sacred-flame-lit.html"><![CDATA[<p>公元2008年05月9日下午，我的博客终于成功开张!</p>
]]></content>
	</entry>
	</feed>
