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

<channel>
	<title>不亦乐乎 &#187; 修改制作</title>
	<atom:link href="http://www.happyet.org/tag/%e4%bf%ae%e6%94%b9%e5%88%b6%e4%bd%9c/feed" rel="self" type="application/rss+xml" />
	<link>http://www.happyet.org</link>
	<description>自娱自乐，不亦乐乎!</description>
	<lastBuildDate>Tue, 07 Feb 2012 05:23:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>WordPress主题模板修改制作入门之DIV+CSS篇</title>
		<link>http://www.happyet.org/251.html</link>
		<comments>http://www.happyet.org/251.html#comments</comments>
		<pubDate>Fri, 10 Jul 2009 03:41:05 +0000</pubDate>
		<dc:creator>LMS</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[DIV]]></category>
		<category><![CDATA[主题模板]]></category>
		<category><![CDATA[修改制作]]></category>

		<guid isPermaLink="false">http://www.happyet.org/archives/251</guid>
		<description><![CDATA[看一下时间，上一篇关于wordpress模板函数到现在已经一个月过去了，时间过的真是快啊。其实关于div和css并没有什么东西可写，因为本身我自己是一个菜鸟，左思右想不知道能写什么，但是想想自己以前从对div和css一无所知到看的懂，并能加以修改所花的漫长时间上，所以还是决定写一些，可能会零碎、不专业和肤浅，但希望对像我这样业余的初学者有一些帮助吧。 我一直觉得利用wordpress来学习div和css是非常好的，原因有2，一是wordpress是纯div和css构架，二是wp的div不会很复杂（当然，你也可以把它搞的非常复杂，不过这些是牛人做的），但是涉及的css又非常完整，因为它本身就是一个独立的涉及各方面的但是不复杂的网站。 在开始说wp主题模板前，先简单说一下div和css，div也就是俗称容器，顾名思义，装网页内容的，完整格式是：&#60;div&#62;网页内容&#60;/div&#62;，因为一个页面通常会涉及很多的容器，所以要给容器贴上标签以便容易区别和确认，有的标签可能在一个页面里是独立的，只能被用一次，或只用到一次，而有的标签在页面里会反复的被使用到。 对于这两种情况又加以区分： 第一种：独立的，只能用一次或只使用一次的标签，我们用ID来表示，格式是&#60;div id=”标签名”&#62;网页内容&#60;/div&#62; 第二种：通用的，经常被用到的标签，用class来表示，格式是&#60;div class=”标签名”&#62;网页内容&#60;/div&#62; 有一点需要说明的是，能用id的地方一定可以用class，用class的地方不一定就能用id，但是对于id的唯一性，最好是用id的地方还是用id的好。 以我目前的水平，所有涉及div的知识，我知道的就上面这两个了，div装着网页内容被放在一个页面上是至上而下排列的，如果你想按你的意思让各个div容器放在你想要的位置，就得用css来格式定义它，定义div的样式和位置是通过定义上面说的给div确定的标签来实现的。 在css（style.css文件）里对于ID和CLASS标签是通过#、.两个符号来认识的，ID对应的是“#”，CLASS对应的是“.”（英文输入状态下的句号）。具体格式如下： 网页页面上内容：&#60;div id=”id”&#62;id标签下div容器里的内容&#60;/div&#62;&#60;div class=”class”&#62;class标签下div容器里的内容&#60;/div&#62; css文件里的内容：#id {给id标签容器定义的样式1; 给id标签容器定义的样式2;}  .class{给class标签容器定义的样式1; 给class标签容器定义的样式2;} 总体上就是这样，现在结合wordpress模板来简单说一下，从第一篇我介绍的wp主题模板的文件结构中已经了解各文件是怎么组合的了，我们以组合后的首页为例来看看大多数wordpress是怎么设置div的： &#60;div id=”wrapper”&#62;——这个是最大的容器，包含所有页面内容的，因为它是唯一的无论哪个页面都只用到一次，所以用id来定义它，当然你也可以用class。 &#60;div id=”header”&#62;这里是头部的内容，也是唯一的&#60;/div&#62; &#60;div id=”content”&#62;页面主要内容部分，也是唯一的&#60;/div&#62; &#60;div id=”comment”&#62;评论部分内容（不在首页），也是唯一的&#60;/div&#62; &#60;div id=”sidebar”&#62;侧边栏的容器，也是唯一的&#60;/div&#62; &#60;div id=”footer”&#62;底部的内容，也是唯一的&#60;/div&#62; &#60;/div&#62;这里是收起最大的容器wrapper的，不能丢了。 我们再来看一下index.php里的div设置：(谷歌浏览器奔溃，吓我一跳，还好，这以上的内容都在。。。) 引用header文件 &#60;div id=”content”&#62;——这个容器含侧边栏，一般放在header.php最下面 &#60;div id=”main”&#62;——这个是内容容器 &#60;div class=”title”&#62;日志的题目，不唯一&#60;/div&#62; &#60;div class=”postmeta”&#62;题目下的日期等等之类的，不唯一&#60;/div&#62; &#60;div class=”entry”&#62;日志内容或日志摘要&#60;/div&#62; &#60;/div&#62;收起main容器 引用侧边栏 &#60;/div&#62;收起conten容器，一般在footer.php文件最上面 关于CSS的属性说多不多，说少也不少，不过足够让我们这样的初学者头晕脑涨的了，而且，各种各样的浏览器对一些属性的兼容性又有所不同，所以，如果你要自己弄wp的主题模板，除了要在本机上搭个php环境外，你还得装至少两个的浏览器，IE和firefox，当然，你也可以不鸟ie浏览器的用户。 下面是我自己捣鼓的几个wp皮，还有两个没弄完整。 1. 仿boblog主题mixice 2. WordPress仿boblog“谷子骚” 3. [...]<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="118" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="WordPress主题模板修改制作入门之文件结构篇" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.happyet.org%2F176.html&from=http%3A%2F%2Fwww.happyet.org%2F251.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 112px !important; height: 112px !important;" src="http://static.wumii.com/site_images/2010/12/17/1271184.jpg" width="112px" height="112px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 118px !important; font: 12px/15px arial !important; height: 30px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress主题模板修改制作入门之文件结构篇</font>
                    </a>
                </td>
                <td width="118" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress主题模板修改制作入门之模板函数篇" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.happyet.org%2F222.html&from=http%3A%2F%2Fwww.happyet.org%2F251.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 112px !important; height: 112px !important;" src="http://static.wumii.com/site_images/2010/12/17/1271503.jpg" width="112px" height="112px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 118px !important; font: 12px/15px arial !important; height: 30px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress主题模板修改制作入门之模板函数篇</font>
                    </a>
                </td>
                <td width="118" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="仿boblog主题mixice发布分享" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.happyet.org%2F232.html&from=http%3A%2F%2Fwww.happyet.org%2F251.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 112px !important; height: 112px !important;" src="http://static.wumii.com/site_images/2010/12/17/1271308.gif" width="112px" height="112px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 118px !important; font: 12px/15px arial !important; height: 30px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">仿boblog主题mixice发布分享</font>
                    </a>
                </td>
                <td width="118" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress自用简洁主题分享" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.happyet.org%2F367.html&from=http%3A%2F%2Fwww.happyet.org%2F251.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 112px !important; height: 112px !important;" src="http://static.wumii.com/site_images/2010/12/17/1271401.jpg" width="112px" height="112px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 118px !important; font: 12px/15px arial !important; height: 30px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress自用简洁主题分享</font>
                    </a>
                </td>
                <td width="118" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="给博客换换衣裳" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.happyet.org%2F282.html&from=http%3A%2F%2Fwww.happyet.org%2F251.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 112px !important; height: 112px !important;" src="http://static.wumii.com/site_images/2010/12/17/1271443.gif" width="112px" height="112px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 118px !important; font: 12px/15px arial !important; height: 30px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">给博客换换衣裳</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>看一下时间，上一篇关于<a href="http://www.happyet.org/archives/222">wordpress模板函数</a>到现在已经一个月过去了，时间过的真是快啊。其实关于div和css并没有什么东西可写，因为本身我自己是一个菜鸟，左思右想不知道能写什么，但是想想自己以前从对div和css一无所知到看的懂，并能加以修改所花的漫长时间上，所以还是决定写一些，<strong>可能会零碎、不专业和肤浅，但希望对像我这样业余的初学者有一些帮助</strong>吧。</p>
<p>我一直觉得利用wordpress来学习div和css是非常好的，原因有2，一是wordpress是纯div和css构架，二是wp的div不会很复杂（当然，你也可以把它搞的非常复杂，不过这些是牛人做的），但是涉及的css又非常完整，因为它本身就是一个独立的涉及各方面的但是不复杂的网站。</p>
<p>在开始说wp主题模板前，先简单说一下div和css，div也就是俗称容器，顾名思义，装网页内容的，完整格式是：<strong>&lt;div&gt;网页内容&lt;/div&gt;</strong>，因为一个页面通常会涉及很多的容器，<strong>所以要给容器贴上标签以便容易区别和确认</strong>，有的标签可能在一个页面里是独立的，只能被用一次，或只用到一次，而有的标签在页面里会反复的被使用到。</p>
<p>对于这两种情况又加以区分：</p>
<p><strong>第一种：独立的，只能用一次或只使用一次的标签，我们用ID来表示，格式是&lt;div id=”标签名”&gt;网页内容&lt;/div&gt;</strong></p>
<p><strong>第二种：通用的，经常被用到的标签，用class来表示，格式是&lt;div class=”标签名”&gt;网页内容&lt;/div&gt;</strong></p>
<p>有一点需要说明的是，<strong>能用id的地方一定可以用class，用class的地方不一定就能用id，但是对于id的唯一性，最好是用id的地方还是用id的好</strong>。</p>
<p>以我目前的水平，所有涉及div的知识，我知道的就上面这两个了，div装着网页内容被放在一个页面上是至上而下排列的，如果你想按你的意思让各个div容器放在你想要的位置，就得用css来格式定义它，<strong>定义div的样式和位置是通过定义上面说的给div确定的标签来实现的。</strong></p>
<p><strong> </strong>在css（style.css文件）里对于ID和CLASS标签是通过#、.两个符号来认识的，<strong>ID对应的是“#”，CLASS对应的是“.”</strong>（英文输入状态下的句号）。具体格式如下：</p>
<blockquote><p>网页页面上内容：&lt;div id=”id”&gt;id标签下div容器里的内容&lt;/div&gt;&lt;div class=”class”&gt;class标签下div容器里的内容&lt;/div&gt;</p>
<p>css文件里的内容：#id {给id标签容器定义的样式1; 给id标签容器定义的样式2;}  .class{给class标签容器定义的样式1; 给class标签容器定义的样式2;}</p></blockquote>
<p>总体上就是这样，现在结合wordpress模板来简单说一下，从第一篇我介绍的<a href="http://www.happyet.org/archives/176">wp主题模板的文件结构</a>中已经了解各文件是怎么组合的了，我们以组合后的首页为例来看看大多数wordpress是怎么设置div的：</p>
<blockquote><p>&lt;div id=”wrapper”&gt;——这个是最大的容器，包含所有页面内容的，因为它是唯一的无论哪个页面都只用到一次，所以用id来定义它，当然你也可以用class。</p>
<p>&lt;div id=”header”&gt;这里是头部的内容，也是唯一的&lt;/div&gt;</p>
<p>&lt;div id=”content”&gt;页面主要内容部分，也是唯一的&lt;/div&gt;</p>
<p>&lt;div id=”comment”&gt;评论部分内容（不在首页），也是唯一的&lt;/div&gt;</p>
<p>&lt;div id=”sidebar”&gt;侧边栏的容器，也是唯一的&lt;/div&gt;</p>
<p>&lt;div id=”footer”&gt;底部的内容，也是唯一的&lt;/div&gt;</p>
<p>&lt;/div&gt;这里是收起最大的容器wrapper的，不能丢了。</p></blockquote>
<p>我们再来看一下index.php里的div设置：(谷歌浏览器奔溃，吓我一跳，还好，这以上的内容都在。。。)</p>
<blockquote><p>引用header文件</p>
<p>&lt;div id=”content”&gt;——这个容器含侧边栏，一般放在header.php最下面</p>
<p>&lt;div id=”main”&gt;——这个是内容容器</p>
<p>&lt;div class=”title”&gt;日志的题目，不唯一&lt;/div&gt;</p>
<p>&lt;div class=”postmeta”&gt;题目下的日期等等之类的，不唯一&lt;/div&gt;</p>
<p>&lt;div class=”entry”&gt;日志内容或日志摘要&lt;/div&gt;</p>
<p>&lt;/div&gt;收起main容器</p>
<p>引用侧边栏</p>
<p>&lt;/div&gt;收起conten容器，一般在footer.php文件最上面</p></blockquote>
<p>关于<a href="http://www.happyet.org/archives/214">CSS的属性</a>说多不多，说少也不少，不过足够让我们这样的初学者头晕脑涨的了，而且，各种各样的浏览器对一些属性的兼容性又有所不同，所以，如果你要自己弄wp的主题模板，除了要<a href="http://www.happyet.org/archives/209">在本机上搭个php环境</a>外，你还得装至少两个的浏览器，IE和firefox，当然，你也可以不鸟ie浏览器的用户。</p>
<p>下面是我自己捣鼓的几个wp皮，还有两个没弄完整。</p>
<p>1. <a href="http://www.happyet.org/archives/232">仿boblog主题mixice</a></p>
<p>2. <a href="http://www.happyet.org/archives/183">WordPress仿boblog“谷子骚”</a></p>
<p>3. <a href="http://www.happyet.org/archives/121">WordPress仿QQ校友风格</a></p>
<p>4. 本站目前在用的这个。。。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="118" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="WordPress主题模板修改制作入门之文件结构篇" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.happyet.org%2F176.html&from=http%3A%2F%2Fwww.happyet.org%2F251.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 112px !important; height: 112px !important;" src="http://static.wumii.com/site_images/2010/12/17/1271184.jpg" width="112px" height="112px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 118px !important; font: 12px/15px arial !important; height: 30px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress主题模板修改制作入门之文件结构篇</font>
                    </a>
                </td>
                <td width="118" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress主题模板修改制作入门之模板函数篇" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.happyet.org%2F222.html&from=http%3A%2F%2Fwww.happyet.org%2F251.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 112px !important; height: 112px !important;" src="http://static.wumii.com/site_images/2010/12/17/1271503.jpg" width="112px" height="112px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 118px !important; font: 12px/15px arial !important; height: 30px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress主题模板修改制作入门之模板函数篇</font>
                    </a>
                </td>
                <td width="118" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="仿boblog主题mixice发布分享" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.happyet.org%2F232.html&from=http%3A%2F%2Fwww.happyet.org%2F251.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 112px !important; height: 112px !important;" src="http://static.wumii.com/site_images/2010/12/17/1271308.gif" width="112px" height="112px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 118px !important; font: 12px/15px arial !important; height: 30px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">仿boblog主题mixice发布分享</font>
                    </a>
                </td>
                <td width="118" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress自用简洁主题分享" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.happyet.org%2F367.html&from=http%3A%2F%2Fwww.happyet.org%2F251.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 112px !important; height: 112px !important;" src="http://static.wumii.com/site_images/2010/12/17/1271401.jpg" width="112px" height="112px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 118px !important; font: 12px/15px arial !important; height: 30px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress自用简洁主题分享</font>
                    </a>
                </td>
                <td width="118" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="给博客换换衣裳" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.happyet.org%2F282.html&from=http%3A%2F%2Fwww.happyet.org%2F251.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 112px !important; height: 112px !important;" src="http://static.wumii.com/site_images/2010/12/17/1271443.gif" width="112px" height="112px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 118px !important; font: 12px/15px arial !important; height: 30px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">给博客换换衣裳</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.happyet.org/251.html/feed</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>WordPress主题模板修改制作入门之模板函数篇</title>
		<link>http://www.happyet.org/222.html</link>
		<comments>http://www.happyet.org/222.html#comments</comments>
		<pubDate>Tue, 09 Jun 2009 13:02:29 +0000</pubDate>
		<dc:creator>LMS</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[主题模板]]></category>
		<category><![CDATA[修改制作]]></category>
		<category><![CDATA[模板函数]]></category>

		<guid isPermaLink="false">http://www.happyet.org/archives/222</guid>
		<description><![CDATA[在上篇介绍了关于wp主题模板的文件结构到现在又好几天过去了，时间真快啊，我一个模板断断续续的都还没做完呢，今天来列举一下wordpress常用到的一些函数吧。 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 [...]<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="118" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="WordPress主题模板修改制作入门之DIV+CSS篇" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.happyet.org%2F251.html&from=http%3A%2F%2Fwww.happyet.org%2F222.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 112px !important; height: 112px !important;" src="http://static.wumii.com/site_images/2010/12/27/1271365.jpg" width="112px" height="112px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 118px !important; font: 12px/15px arial !important; height: 30px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress主题模板修改制作入门之DIV+CSS篇</font>
                    </a>
                </td>
                <td width="118" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress主题模板修改制作入门之文件结构篇" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.happyet.org%2F176.html&from=http%3A%2F%2Fwww.happyet.org%2F222.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 112px !important; height: 112px !important;" src="http://static.wumii.com/site_images/2010/12/17/1271184.jpg" width="112px" height="112px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 118px !important; font: 12px/15px arial !important; height: 30px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress主题模板修改制作入门之文件结构篇</font>
                    </a>
                </td>
                <td width="118" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress自用简洁主题分享" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.happyet.org%2F367.html&from=http%3A%2F%2Fwww.happyet.org%2F222.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 112px !important; height: 112px !important;" src="http://static.wumii.com/site_images/2010/12/17/1271401.jpg" width="112px" height="112px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 118px !important; font: 12px/15px arial !important; height: 30px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress自用简洁主题分享</font>
                    </a>
                </td>
                <td width="118" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="新主题lms" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.happyet.org%2F370.html&from=http%3A%2F%2Fwww.happyet.org%2F222.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 112px !important; height: 112px !important;" src="http://static.wumii.com/site_images/2010/12/17/1271399.gif" width="112px" height="112px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 118px !important; font: 12px/15px arial !important; height: 30px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">新主题lms</font>
                    </a>
                </td>
                <td width="118" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="仿boblog主题mixice发布分享" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.happyet.org%2F232.html&from=http%3A%2F%2Fwww.happyet.org%2F222.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 112px !important; height: 112px !important;" src="http://static.wumii.com/site_images/2010/12/17/1271308.gif" width="112px" height="112px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 118px !important; font: 12px/15px arial !important; height: 30px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">仿boblog主题mixice发布分享</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>在上篇介绍了<a href="http://www.happyet.org/?p=176">关于wp主题模板的文件结构</a>到现在又好几天过去了，时间真快啊，我一个模板断断续续的都还没做完呢，今天来列举一下wordpress常用到的一些函数吧。</p>

<div class="wp_syntax"><table><tr><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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">1. 调用模板函数：
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_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: #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> : 调用Header模板 
<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> : 调用Sidebar模板 
<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> : 调用Footer模板 
<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> : 显示内容(Post/Page) 
<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> : 检查是否存在Post/Page 
<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> : 如果存在Post/Page则予以显示 
<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> : While 结束 
<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> : If 结束 
<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_time<span style="color: #009900;">&#40;</span>’字符串’<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> : 显示时间，时间格式由“字符串”参数决定，具体参考PHP手册 
<span style="color: #000000; font-weight: bold;">&lt;?php</span> comments_popup_link<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> : 正文中的留言链接。如果使用 comments_popup_script() ，则留言会在新窗口中打开，反之，则在当前窗口打开 
<span style="color: #000000; font-weight: bold;">&lt;?php</span> 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> : 内容页(Post/Page)标题 
<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> : 内容页(Post/Page) Url 
<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_category<span style="color: #009900;">&#40;</span>’<span style="color: #339933;">,</span> ‘<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> : 特定内容页(Post/Page)所属Category 
<span style="color: #000000; font-weight: bold;">&lt;?php</span> 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: #000000; font-weight: bold;">&lt;?php</span> the_ID<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> : 特定内容页(Post/Page) ID 
<span style="color: #000000; font-weight: bold;">&lt;?php</span> edit_post_link<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_links_list<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> : 显示Blogroll中的链接 
<span style="color: #000000; font-weight: bold;">&lt;?php</span> comments_template<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_list_pages<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> : 显示Page列表 
<span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_list_categories<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> : 显示Categories列表 
<span style="color: #000000; font-weight: bold;">&lt;?php</span> next_post_link<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' %link '</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> previous_post_link<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'%link'</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_calendar<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_get_archives<span style="color: #009900;">&#40;</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> posts_nav_link<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> <span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span>TEMPLATEPATH <span style="color: #339933;">.</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> : 嵌入其他文件，可为定制的模板或其他类型文件
&nbsp;
2. 基本条件判断的函数
&nbsp;
is_home() : 是否为主页 
is_single() : 是否为内容页(Post) 
is_page() : 是否为内容页(Page) 
is_category() : 是否为Category/Archive页 
is_tag() : 是否为Tag存档页 
is_date() : 是否为指定日期存档页 
is_year() : 是否为指定年份存档页 
is_month() : 是否为指定月份存档页 
is_day() : 是否为指定日存档页 
is_time() : 是否为指定时间存档页 
is_author() : 是否为指定作者存档页 
is_archive() : 是否为存档页 
is_search() : 是否为搜索结果页 
is_404() : 是否为 “HTTP 404: Not Found” 错误页 
is_paged() : 主页/Category/Archive页是否以多页显示 
&nbsp;
上面这些函数的用法一般都为<span style="color: #000000; font-weight: bold;">&lt;?php</span>  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> is_home<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>  <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>如果是home页，这里显示的内容<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>，这个用EditPlus打开默认模板里的archive.php文件，前面十几行都能找的到上面的函数。
&nbsp;
3. Header部分常用到的函数
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> bloginfo<span style="color: #009900;">&#40;</span>’name’<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> : 博客名称(Title) 
<span style="color: #000000; font-weight: bold;">&lt;?php</span> bloginfo<span style="color: #009900;">&#40;</span>’stylesheet_url’<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> : CSS文件路径 
<span style="color: #000000; font-weight: bold;">&lt;?php</span> bloginfo<span style="color: #009900;">&#40;</span>’pingback_url’<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> : PingBack Url 
<span style="color: #000000; font-weight: bold;">&lt;?php</span> bloginfo<span style="color: #009900;">&#40;</span>’template_url’<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> bloginfo<span style="color: #009900;">&#40;</span>’version’<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> : WordPress版本 
<span style="color: #000000; font-weight: bold;">&lt;?php</span> bloginfo<span style="color: #009900;">&#40;</span>’atom_url’<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> : Atom Url 
<span style="color: #000000; font-weight: bold;">&lt;?php</span> bloginfo<span style="color: #009900;">&#40;</span>’rss2_url’<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> : RSS 2.o Url 
<span style="color: #000000; font-weight: bold;">&lt;?php</span> bloginfo<span style="color: #009900;">&#40;</span>’url’<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> : 博客 Url 
<span style="color: #000000; font-weight: bold;">&lt;?php</span> bloginfo<span style="color: #009900;">&#40;</span>’html_type’<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> : 博客网页Html类型 
<span style="color: #000000; font-weight: bold;">&lt;?php</span> bloginfo<span style="color: #009900;">&#40;</span>’charset’<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> bloginfo<span style="color: #009900;">&#40;</span>’description’<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_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> : 特定内容页(Post/Page)的标题
&nbsp;
4. 与模板相关的其他函数
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span>’Message’<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_register<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_loginout<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> : 显示登录/注销链接 
&lt;!–next page–&gt; : 将当前内容分页 
&lt;!–more–&gt; : 将当前内容截断，以不在主页/目录页显示全部内容 
<span style="color: #000000; font-weight: bold;">&lt;?php</span> timer_stop<span style="color: #009900;">&#40;</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: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> get_num_queries<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;
5. 置顶判断函数
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>is_sticky<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #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: #b1b100;">else</span><span style="color: #009900;">&#123;</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: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>更详细的信息请参考WordPress官方文档。<br />
wordpress官方文档：http://codex.wordpress.org/Main_Page</p>
<p>下一篇，也是最后一篇，分享一下我对DIV和CSS的一点认识。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="118" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="WordPress主题模板修改制作入门之DIV+CSS篇" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.happyet.org%2F251.html&from=http%3A%2F%2Fwww.happyet.org%2F222.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 112px !important; height: 112px !important;" src="http://static.wumii.com/site_images/2010/12/27/1271365.jpg" width="112px" height="112px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 118px !important; font: 12px/15px arial !important; height: 30px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress主题模板修改制作入门之DIV+CSS篇</font>
                    </a>
                </td>
                <td width="118" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress主题模板修改制作入门之文件结构篇" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.happyet.org%2F176.html&from=http%3A%2F%2Fwww.happyet.org%2F222.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 112px !important; height: 112px !important;" src="http://static.wumii.com/site_images/2010/12/17/1271184.jpg" width="112px" height="112px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 118px !important; font: 12px/15px arial !important; height: 30px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress主题模板修改制作入门之文件结构篇</font>
                    </a>
                </td>
                <td width="118" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress自用简洁主题分享" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.happyet.org%2F367.html&from=http%3A%2F%2Fwww.happyet.org%2F222.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 112px !important; height: 112px !important;" src="http://static.wumii.com/site_images/2010/12/17/1271401.jpg" width="112px" height="112px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 118px !important; font: 12px/15px arial !important; height: 30px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress自用简洁主题分享</font>
                    </a>
                </td>
                <td width="118" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="新主题lms" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.happyet.org%2F370.html&from=http%3A%2F%2Fwww.happyet.org%2F222.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 112px !important; height: 112px !important;" src="http://static.wumii.com/site_images/2010/12/17/1271399.gif" width="112px" height="112px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 118px !important; font: 12px/15px arial !important; height: 30px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">新主题lms</font>
                    </a>
                </td>
                <td width="118" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="仿boblog主题mixice发布分享" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.happyet.org%2F232.html&from=http%3A%2F%2Fwww.happyet.org%2F222.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 112px !important; height: 112px !important;" src="http://static.wumii.com/site_images/2010/12/17/1271308.gif" width="112px" height="112px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 118px !important; font: 12px/15px arial !important; height: 30px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">仿boblog主题mixice发布分享</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.happyet.org/222.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>WordPress主题模板修改制作入门之文件结构篇</title>
		<link>http://www.happyet.org/176.html</link>
		<comments>http://www.happyet.org/176.html#comments</comments>
		<pubDate>Fri, 05 Jun 2009 08:42:55 +0000</pubDate>
		<dc:creator>LMS</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[主题模板]]></category>
		<category><![CDATA[修改制作]]></category>
		<category><![CDATA[文件结构]]></category>

		<guid isPermaLink="false">http://www.happyet.org/?p=176</guid>
		<description><![CDATA[本人Wordpress超级菜鸟，不懂php，在自己摸索修改模仿了几张Wordpress主题模板之后（包括已经发出来的《仿boblog“谷子骚”模板》,和《仿QQ校友风格》，还有其他一两个发布在精品空间论坛的以及目前自己在用的），就心理痒痒的想和大家分享不成熟的经验了，有什么不正确或者不足的地方欢迎指正补充。 废话少说，言归正传。 WordPress安装结束后，在折腾Wordpress主题模板前，得先了解它涉及的文件和各文件所起的作用，WordPress的模板目录在：“程序安装的根目录\wp-content\themes\”下，以默认主题模板为例，模板文件就在“程序安装的根目录\wp-content\themes\default”default这个文件夹下了。对于像我这样的菜鸟，整个wordpress可捣鼓的也就是themes这个文件夹了。 一套完整的WordPress主题模板应至少具有如下文件： style.css : CSS(样式表)文件，你的wp主题什么样子就是它决定的 index.php : 主页模板 archive.php : Archive、Category模板，默认存档、分类、标签类模板 404.php : Not Found 错误页模板 comments.php : 留言、回复、评论模板 footer.php : Footer模板，底部 header.php : Header模板 ，头部 sidebar.php : 侧边栏模板 page.php : 内容页(Page)模板，页面模板 single.php : 内容页(Post)模板，单篇日志模板 searchform.php : 搜索表单模板 search.php : 搜索结果模板 functions.php：自定义函数模板   来一张自己画的简单的图来说明一下平时最常见的首页和单篇日志页的文件结构： 就这么简单，一般修改wordpress主题模板，都会涉及到上面这些文件的修改，所以记住哪个文件涉及到哪个页面是很重要的，不然要实现个什么效果都不知道到哪里找。 就算是第一篇吧，下一篇我们说说Wordpress常用到的默认函数.<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="118" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="WordPress主题模板修改制作入门之模板函数篇" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.happyet.org%2F222.html&from=http%3A%2F%2Fwww.happyet.org%2F176.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 112px !important; height: 112px !important;" src="http://static.wumii.com/site_images/2010/12/17/1271503.jpg" width="112px" height="112px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 118px !important; font: 12px/15px arial !important; height: 30px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress主题模板修改制作入门之模板函数篇</font>
                    </a>
                </td>
                <td width="118" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress主题模板修改制作入门之DIV+CSS篇" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.happyet.org%2F251.html&from=http%3A%2F%2Fwww.happyet.org%2F176.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 112px !important; height: 112px !important;" src="http://static.wumii.com/site_images/2010/12/27/1271365.jpg" width="112px" height="112px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 118px !important; font: 12px/15px arial !important; height: 30px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress主题模板修改制作入门之DIV+CSS篇</font>
                    </a>
                </td>
                <td width="118" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="新主题lms" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.happyet.org%2F370.html&from=http%3A%2F%2Fwww.happyet.org%2F176.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 112px !important; height: 112px !important;" src="http://static.wumii.com/site_images/2010/12/17/1271399.gif" width="112px" height="112px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 118px !important; font: 12px/15px arial !important; height: 30px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">新主题lms</font>
                    </a>
                </td>
                <td width="118" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress自用简洁主题分享" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.happyet.org%2F367.html&from=http%3A%2F%2Fwww.happyet.org%2F176.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 112px !important; height: 112px !important;" src="http://static.wumii.com/site_images/2010/12/17/1271401.jpg" width="112px" height="112px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 118px !important; font: 12px/15px arial !important; height: 30px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress自用简洁主题分享</font>
                    </a>
                </td>
                <td width="118" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="百度英文wordpress博客beat主题分享" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.happyet.org%2F549.html&from=http%3A%2F%2Fwww.happyet.org%2F176.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 112px !important; height: 112px !important;" src="http://static.wumii.com/site_images/2011/01/12/2030288.jpg" width="112px" height="112px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 118px !important; font: 12px/15px arial !important; height: 30px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">百度英文wordpress博客beat主题分享</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>本人Wordpress超级菜鸟，不懂php，在自己摸索修改模仿了几张Wordpress主题模板之后（包括已经发出来的<a href="http://www.happyet.org/?p=183">《仿boblog“谷子骚”模板》</a>,和<a href="http://www.happyet.org/?p=121">《仿QQ校友风格》</a>，还有其他一两个发布在<a href="http://www.hichf.com" target="_blank">精品空间论坛</a>的以及目前自己在用的），就心理痒痒的想和大家分享不成熟的经验了，有什么不正确或者不足的地方欢迎指正补充。</p>
<p>废话少说，言归正传。</p>
<p><a href="http://www.happyet.org/?p=209">WordPress安装</a>结束后，在折腾Wordpress主题模板前，得先了解它涉及的文件和各文件所起的作用，<strong>WordPress的模板目录在：“程序安装的根目录\wp-content\themes\”下，</strong>以默认主题模板为例，模板文件就在“程序安装的根目录\wp-content\themes\default”default这个文件夹下了。对于像我这样的菜鸟，整个wordpress可捣鼓的也就是themes这个文件夹了。</p>
<p>一套完整的WordPress主题模板应至少具有如下文件：</p>
<blockquote><p>style.css : CSS(样式表)文件，你的wp主题什么样子就是它决定的<br />
index.php : 主页模板<br />
archive.php : Archive、Category模板，默认存档、分类、标签类模板<br />
404.php : Not Found 错误页模板<br />
comments.php : 留言、回复、评论模板<br />
footer.php : Footer模板，底部<br />
header.php : Header模板 ，头部<br />
sidebar.php : 侧边栏模板<br />
page.php : 内容页(Page)模板，页面模板<br />
single.php : 内容页(Post)模板，单篇日志模板<br />
searchform.php : 搜索表单模板<br />
search.php : 搜索结果模板<br />
functions.php：自定义函数模板</p></blockquote>
<p> <br />
来一张自己画的简单的图来说明一下平时最常见的首页和单篇日志页的文件结构：</p>
<p><center><a href="http://www.happyet.org/wp-content/uploads/2009/06/wordpress.jpg"><img class="aligncenter size-full wp-image-219" title="wordpress" src="http://www.happyet.org/wp-content/uploads/2009/06/wordpress.jpg" alt="wordpress" width="500" height="370" /></a></center></p>
<p>就这么简单，一般修改wordpress主题模板，都会涉及到上面这些文件的修改，所以<strong>记住哪个文件涉及到哪个页面是很重要</strong>的，不然要实现个什么效果都不知道到哪里找。</p>
<p>就算是第一篇吧，下一篇我们说说Wordpress常用到的默认函数.</p>
<p style="margin:0;padding:0;height:1px;overflow:hidden;">
    <script type="text/javascript"><!--
        var wumiiSitePrefix = "http://www.happyet.org";
        var wumiiEnableCustomPos = false;
        var wumiiParams = "&#038;num=5&#038;mode=3&#038;displayInFeed=1&#038;version=1.0.5.5&#038;pf=WordPress3.3.1";
    //--></script><script type="text/javascript" src="http://widget.wumii.com/ext/relatedItemsWidget.htm"></script><a href="http://www.wumii.com/widget/relatedItems.htm" style="border:0;"><img src="http://static.wumii.com/images/pixel.png" alt="无觅相关文章插件，快速提升流量" style="border:0;padding:0;margin:0;" /></a></p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="118" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="WordPress主题模板修改制作入门之模板函数篇" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.happyet.org%2F222.html&from=http%3A%2F%2Fwww.happyet.org%2F176.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 112px !important; height: 112px !important;" src="http://static.wumii.com/site_images/2010/12/17/1271503.jpg" width="112px" height="112px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 118px !important; font: 12px/15px arial !important; height: 30px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress主题模板修改制作入门之模板函数篇</font>
                    </a>
                </td>
                <td width="118" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress主题模板修改制作入门之DIV+CSS篇" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.happyet.org%2F251.html&from=http%3A%2F%2Fwww.happyet.org%2F176.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 112px !important; height: 112px !important;" src="http://static.wumii.com/site_images/2010/12/27/1271365.jpg" width="112px" height="112px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 118px !important; font: 12px/15px arial !important; height: 30px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress主题模板修改制作入门之DIV+CSS篇</font>
                    </a>
                </td>
                <td width="118" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="新主题lms" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.happyet.org%2F370.html&from=http%3A%2F%2Fwww.happyet.org%2F176.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 112px !important; height: 112px !important;" src="http://static.wumii.com/site_images/2010/12/17/1271399.gif" width="112px" height="112px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 118px !important; font: 12px/15px arial !important; height: 30px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">新主题lms</font>
                    </a>
                </td>
                <td width="118" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress自用简洁主题分享" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.happyet.org%2F367.html&from=http%3A%2F%2Fwww.happyet.org%2F176.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 112px !important; height: 112px !important;" src="http://static.wumii.com/site_images/2010/12/17/1271401.jpg" width="112px" height="112px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 118px !important; font: 12px/15px arial !important; height: 30px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress自用简洁主题分享</font>
                    </a>
                </td>
                <td width="118" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="百度英文wordpress博客beat主题分享" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.happyet.org%2F549.html&from=http%3A%2F%2Fwww.happyet.org%2F176.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 112px !important; height: 112px !important;" src="http://static.wumii.com/site_images/2011/01/12/2030288.jpg" width="112px" height="112px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 118px !important; font: 12px/15px arial !important; height: 30px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">百度英文wordpress博客beat主题分享</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.happyet.org/176.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

