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

<channel>
	<title>夜阑听雨 &#187; wordpress</title>
	<atom:link href="http://littlepig.cn/tag/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://littlepig.cn</link>
	<description>记录、品味、分享</description>
	<lastBuildDate>Thu, 10 Jun 2010 12:37:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>WordPress 修改常用函数</title>
		<link>http://littlepig.cn/others/site/wordpress-common-function-list/</link>
		<comments>http://littlepig.cn/others/site/wordpress-common-function-list/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 05:11:41 +0000</pubDate>
		<dc:creator>zhz</dc:creator>
				<category><![CDATA[建站笔记]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://littlepig.cn/?p=505</guid>
		<description><![CDATA[　　在配置 WordPress 的过程中，对模板的修改是避免不了的，每次都要 Google 一些函数的用法，找到合适的结果比较繁琐，到官方站点去查也是很慢，这里总结了一些常用的函数方便查询。]]></description>
			<content:encoded><![CDATA[<p>　　在配置 <a href="http://littlepig.cn/tag/wordpress/" class="st_tag internal_tag" rel="tag" title="标签 wordpress 下的日志">WordPress</a> 的过程中，对模板的修改是避免不了的，每次都要 Google 一些函数的用法，比较繁琐，这里总结了一些常用的方便查询。</p>
<p><span id="more-505"></span></p>
<blockquote><p>1&gt;基本条件判断</p>
<p>is_home() : 是否为主页<br />
is_single() : 是否为内容页(Post)<br />
is_page() : 是否为内容页(Page)<br />
is_category() : 是否为Category/Archive页<br />
is_tag() : 是否为Tag存档页<br />
is_date() : 是否为指定日期存档页<br />
is_year() : 是否为指定年份存档页<br />
is_month() : 是否为指定月份存档页<br />
is_day() : 是否为指定日存档页<br />
is_time() : 是否为指定时间存档页<br />
is_archive() : 是否为存档页<br />
is_search() : 是否为搜索结果页<br />
is_404() : 是否为 ‘HTTP 404: Not Found’ 错误页<br />
is_paged() : 主页/Category/Archive页是否以多页显示</p>
<p>2&gt;Header部分涉及的函数</p>
<p>&lt;?php bloginfo(’name’); ?&gt; : 博客名称(Title)<br />
&lt;?php bloginfo(’stylesheet_url’); ?&gt; : CSS文件路径<br />
&lt;?php bloginfo(’pingback_url’); ?&gt; : PingBack Url<br />
&lt;?php bloginfo(’template_url’); ?&gt; : 模板文件路径<br />
&lt;?php bloginfo(’version’); ?&gt; : <a href="http://littlepig.cn/tag/wordpress/" class="st_tag internal_tag" rel="tag" title="标签 wordpress 下的日志">WordPress</a>版本<br />
&lt;?php bloginfo(’atom_url’); ?&gt; : Atom Url<br />
&lt;?php bloginfo(’rss2_url’); ?&gt; : RSS 2.o Url<br />
&lt;?php bloginfo(’url’); ?&gt; : 博客URL<br />
&lt;?php bloginfo(’html_type’); ?&gt; : 博客网页Html类型<br />
&lt;?php bloginfo(’charset’); ?&gt; : 博客网页编码<br />
&lt;?php bloginfo(’description’); ?&gt; : 博客描述<br />
&lt;?php wp_title(); ?&gt; : 内容页面的Title (Post/Page)</p>
<p>3&gt;模板常用的PHP函数及命令</p>
<p>&lt;?php get_header(); ?&gt; : 调用Header模板<br />
&lt;?php get_sidebar(); ?&gt; : 调用Sidebar模板<br />
&lt;?php get_footer(); ?&gt; : 调用Footer模板<br />
&lt;?php the_content(); ?&gt; : 显示内容(Post/Page)<br />
&lt;?php if(have_posts()) : ?&gt; : 检查是否存在Post/Page<br />
&lt;?php while(have_posts()) : the_post(); ?&gt; : 如果存在Post/Page则予以显示<br />
&lt;?php endwhile; ?&gt; : While 结束<br />
&lt;?php endif; ?&gt; : If 结束<br />
&lt;?php the_time(’字符串’) ?&gt; : 显示时间，时间格式由’字符串’参数决定<br />
&lt;?php comments_popup_link(); ?&gt; : 正文中的留言链接。如果使用 comments_popup_script() ，则留言会在新窗口中打开，反之，则在当前窗口打开<br />
&lt;?php the_title(); ?&gt; : 文章标题(Post/Page)<br />
&lt;?php the_permalink() ?&gt; : 内容页URL(Post/Page)<br />
&lt;?php the_category(’,&#8217;) ?&gt; : 特定内容页所属Category(Post/Page)<br />
&lt;?php the_author(); ?&gt; : 文章作者<br />
&lt;?php the_ID(); ?&gt; : 特定内容页(Post/Page) ID<br />
&lt;?php edit_post_link(); ?&gt; : 如果用户已登录并具有权限，显示编辑链接<br />
&lt;?php get_links_list(); ?&gt; : 显示Blogroll中的链接<br />
&lt;?php comments_template(); ?&gt; : 调用留言/回复模板<br />
&lt;?php wp_list_pages(); ?&gt; : 显示Page列表<br />
&lt;?php wp_list_categories(); ?&gt; : 显示Categories列表<br />
&lt;?php next_post_link(’ %link’); ?&gt; : 下一篇文章链接<br />
&lt;?php previous_post_link(’%link’); ?&gt; : 上一篇文章链接<br />
&lt;?php get_calendar(); ?&gt; : 日历<br />
&lt;?php wp_get_archives() ?&gt; : 显示内容存档<br />
&lt;?php posts_nav_link(); ?&gt; : 导航，显示上一篇/下一篇文章链接</p>
<p>4&gt;其他模板相关函数</p>
<p>&lt;?php _e(’Message’); ?&gt; : 输出相应信息<br />
&lt;?php wp_register(); ?&gt; : 显示注册链接<br />
&lt;?php wp_loginout(); ?&gt; : 显示登录/注销链接<br />
&lt;!–next page–&gt; : 将当前内容分页<br />
&lt;!–more–&gt; : 将当前内容截断，以不在主页/目录页显示全部内容<br />
&lt;?php timer_stop(1); ?&gt; : 网页加载时间(秒)<br />
&lt;?php echo get_num_queries(); ?&gt; : 网页加载查询量</p>
<p>5&gt;一些常用的，我会及时补充</p>
<p>&lt;?php if(current_user_can(&#8216;level_0&#8242;)) :判断用户权限</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://littlepig.cn/others/site/wordpress-common-function-list/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
