<?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; WP相关</title>
	<atom:link href="http://www.11mc.cn/tag/wordpress/feed" rel="self" type="application/rss+xml" />
	<link>http://www.11mc.cn</link>
	<description>小文收集-收集新奇有趣的的互联网资源……</description>
	<lastBuildDate>Mon, 16 Aug 2010 05:47:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>让内容只在wordpress的首页中的第一页显示</title>
		<link>http://www.11mc.cn/wordpress-shouye.html</link>
		<comments>http://www.11mc.cn/wordpress-shouye.html#comments</comments>
		<pubDate>Wed, 23 Jun 2010 11:21:37 +0000</pubDate>
		<dc:creator>xiao文</dc:creator>
				<category><![CDATA[WP相关]]></category>

		<guid isPermaLink="false">http://www.11mc.cn/?p=1187</guid>
		<description><![CDATA[有时候我们想实现某些内容只在首页出现，而不在其他页面中爆露，这时我们可以用 is_home() 来做判断，不过这时候还是不够完美，因为单用这个函数内容会出现在首页的page1 page2 page3……页中，如何真正做到只出现在首页的第一页呢？ 其实方法很简单，在后面再加多一个is_paged()条件函数就可以了，比如我想让友情链接只出现在首页的第一页，可以写成下面的形式： &#60;?php if(is_home()&#38;&#38;!is_paged()) { ?&#62; &#60;h4&#62;友情链接&#60;/h4&#62; &#60;ul class=&#8221;flink&#8221;&#62; &#60;?php get_links(&#8221;, &#8216;&#60;li&#62;&#8217;, &#8216;&#60;/li&#62;&#8217;, &#8216; &#8216;, FALSE, &#8216;id&#8217;, FALSE, FALSE, -1, FALSE); ?&#62; &#60;/ul&#62; &#60;?php } ?&#62; 我们还可以把 is_home 换成is_category() 实现只在分类第一页中显示，换成 is_tag()实现只在标签的第一页中显示……其他的自己换了，不一一列举。 在这里额外补充一点，如果用了query_post()函数，会造成is_home()等的判断失效，解决的方法是在用了query_post()后再加一个wp_reset_query()，如下面 &#60;?php query_posts(&#8216;showposts=5&#38;orderby=date&#8217;); ?&#62; &#60;?php while (have_posts()) : the_post(); ?&#62; &#8230;&#8230; &#60;?php endwhile; ?&#62; &#60;?php wp_reset_query(); ?&#62; 转自——望书小屋]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://www.11mc.cn/wordpress-shouye.html"><img class="aligncenter" title="让内容只在wordpress的首页中的第一页显示" src="http://44.images22.51img1.com/6000/lloooooo/4e0279d1c2b9b57405730ff155a38aa0.jpg" alt="" width="449" height="249" /></a></p>
<p>有时候我们想实现某些内容只在首页出现，而不在其他页面中爆露，这时我们可以用 is_home() 来做判断，不过这时候还是不够完美，因为单用这个函数内容会出现在首页的page1 page2 page3……页中，如何真正做到只出现在首页的第一页呢？</p>
<p><span id="more-1187"></span>其实方法很简单，在后面再加多一个is_paged()条件函数就可以了，比如我想让友情链接只出现在首页的第一页，可以写成下面的形式：</p>
<p>&lt;?php if(is_home()&amp;&amp;!is_paged()) { ?&gt;</p>
<p>&lt;h4&gt;友情链接&lt;/h4&gt;</p>
<p>&lt;ul class=&#8221;flink&#8221;&gt;</p>
<p>&lt;?php get_links(&#8221;, &#8216;&lt;li&gt;&#8217;, &#8216;&lt;/li&gt;&#8217;, &#8216; &#8216;, FALSE, &#8216;id&#8217;, FALSE, FALSE, -1, FALSE); ?&gt;</p>
<p>&lt;/ul&gt;</p>
<p>&lt;?php } ?&gt;</p>
<p>我们还可以把 is_home 换成is_category() 实现只在分类第一页中显示，换成 is_tag()实现只在标签的第一页中显示……其他的自己换了，不一一列举。</p>
<p>在这里额外补充一点，如果用了query_post()函数，会造成is_home()等的判断失效，解决的方法是在用了query_post()后再加一个wp_reset_query()，如下面</p>
<p>&lt;?php query_posts(&#8216;showposts=5&amp;orderby=date&#8217;); ?&gt;</p>
<p>&lt;?php while (have_posts()) : the_post(); ?&gt;</p>
<p>&#8230;&#8230;</p>
<p>&lt;?php endwhile; ?&gt;</p>
<p>&lt;?php wp_reset_query(); ?&gt;</p>
<p>转自——<a href="http://wang-shu.cn/92/" target="_blank">望书小屋</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.11mc.cn/wordpress-shouye.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>调用第一篇最新文章</title>
		<link>http://www.11mc.cn/diaoyong-zuixingwenzhang.html</link>
		<comments>http://www.11mc.cn/diaoyong-zuixingwenzhang.html#comments</comments>
		<pubDate>Sun, 25 Jan 2009 07:59:30 +0000</pubDate>
		<dc:creator>xiao文</dc:creator>
				<category><![CDATA[WP相关]]></category>
		<category><![CDATA[代码]]></category>

		<guid isPermaLink="false">http://www.11mc.cn/?p=147</guid>
		<description><![CDATA[厄，到处游荡 看到下面的代码就复制,粘贴过来了。第六感告诉我以后俺会用得到的………%…￥^ 6￥选取最新的一篇文章的基本代码: &#60;?php query_posts(&#8216;showposts=1&#8242;); while (have_posts()) : the_post(); ?&#62; &#60;h3&#62;&#60;a href=&#8221;&#60;?php the_permalink() ?&#62;&#8221; title=&#8221;&#60;?php the_title(); ?&#62;&#8221; rel=&#8221;bookmark&#8221;&#62;&#60;?php the_title(); ?&#62;&#60;/a&#62;&#60;/h3&#62; &#60;?php the_excerpt(&#8216;Continue Reading &#38;raquo;&#8217;); ?&#62; &#60;?php endwhile; ?&#62; &#8216;showposts=1&#8242;表示选取第一篇文章哦 &#60;?php query_posts(&#8216;showposts=4&#38;offset=1&#8242;); while (have_posts()) : the_post(); ?&#62; &#8216;showposts=4&#38;offset=1&#8242;); 表示选取4篇文章，去除第一篇文章，也就是选取除去第一篇文章外的最新4篇文章 &#60;?php query_posts(&#8216;showposts=4&#38;offset=1&#38;cat=2&#8242;); while (have_posts()) : the_post(); ?&#62; &#8216;showposts=4&#38;offset=1&#38;cat=2&#8242; 表示选取分类ID为2的4篇文章，去除分类ID为2第一篇文章，也就是选取除去第一篇文章外的最新4篇文章]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://www.11mc.cn/diaoyong-zuixingwenzhang.html" target="_blank"><img class="aligncenter" title="调用第一篇最新文章" src="http://4c.images22.51img1.com/6000/lloooooo/c47b23a5c8a902b30874ad49664a516e.jpg" alt="" width="629" height="144" /></a></p>
<p>厄，到处游荡 看到下面的代码就复制,粘贴过来了。第六感告诉我以后俺会用得到的………%…￥^ 6￥选取最新的一篇文章的基本代码:</p>
<p><span id="more-147"></span></p>
<blockquote><p>&lt;?php query_posts(&#8216;showposts=1&#8242;); while (have_posts()) : the_post(); ?&gt;</p>
<p>&lt;h3&gt;&lt;a href=&#8221;&lt;?php the_permalink() ?&gt;&#8221; title=&#8221;&lt;?php the_title(); ?&gt;&#8221; rel=&#8221;bookmark&#8221;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h3&gt;</p>
<p>&lt;?php the_excerpt(&#8216;Continue Reading &amp;raquo;&#8217;); ?&gt;</p>
<p>&lt;?php endwhile; ?&gt;</p>
<p>&#8216;showposts=1&#8242;表示选取第一篇文章哦</p></blockquote>
<blockquote><p>&lt;?php query_posts(&#8216;showposts=4&amp;offset=1&#8242;); while (have_posts()) : the_post(); ?&gt;</p>
<p>&#8216;showposts=4&amp;offset=1&#8242;); 表示选取4篇文章，去除第一篇文章，也就是选取除去第一篇文章外的最新4篇文章</p></blockquote>
<blockquote><p>&lt;?php query_posts(&#8216;showposts=4&amp;offset=1&amp;cat=2&#8242;); while (have_posts()) : the_post(); ?&gt;</p>
<p>&#8216;showposts=4&amp;offset=1&amp;cat=2&#8242; 表示选取分类ID为2的4篇文章，去除分类ID为2第一篇文章，也就是选取除去第一篇文章外的最新4篇文章</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.11mc.cn/diaoyong-zuixingwenzhang.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->