<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Creating WordPress Themes: query_posts();</title>
	<atom:link href="http://brassblogs.com/cms-platforms/wordpress/creating-wordpress-themes-query_posts/feed" rel="self" type="application/rss+xml" />
	<link>http://brassblogs.com/cms-platforms/wordpress/creating-wordpress-themes-query_posts</link>
	<description>Web Design located in Simsbury (a suburb of Hartford) CT</description>
	<lastBuildDate>Mon, 26 Jul 2010 11:07:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: David Bell</title>
		<link>http://brassblogs.com/cms-platforms/wordpress/creating-wordpress-themes-query_posts#comment-191</link>
		<dc:creator>David Bell</dc:creator>
		<pubDate>Tue, 25 Aug 2009 11:59:52 +0000</pubDate>
		<guid isPermaLink="false">http://brassblogs.com/?p=141#comment-191</guid>
		<description>Thanks very much for posting this, made it much easier to understand.  I&#039;ll be popping your RSS feed into my Reader, thanks very much.</description>
		<content:encoded><![CDATA[<p>Thanks very much for posting this, made it much easier to understand.  I&#8217;ll be popping your RSS feed into my Reader, thanks very much.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shelly</title>
		<link>http://brassblogs.com/cms-platforms/wordpress/creating-wordpress-themes-query_posts#comment-178</link>
		<dc:creator>Shelly</dc:creator>
		<pubDate>Mon, 10 Aug 2009 13:01:56 +0000</pubDate>
		<guid isPermaLink="false">http://brassblogs.com/?p=141#comment-178</guid>
		<description>well, using the $post-&gt;ID basically just grabs the current post ID and retains it as avariable.  Then in the next loop, it uses it as a flag: if the post ID from before matches the ID of the posts that&#039;s being Looped, then it&#039;ll ignore it.  (The second query Loops through allt he posts again, so it&#039;ll find the post that&#039;s already displayed by the first query, and display it unless you tell it not to.)

An alternate version to this is to simply use &quot;offset&quot; - then if you&#039;re displaying the first post from a category in the first query, you can just &quot;offset=1&quot; in the second, and it&#039;ll just skip the first post.</description>
		<content:encoded><![CDATA[<p>well, using the $post->ID basically just grabs the current post ID and retains it as avariable.  Then in the next loop, it uses it as a flag: if the post ID from before matches the ID of the posts that&#8217;s being Looped, then it&#8217;ll ignore it.  (The second query Loops through allt he posts again, so it&#8217;ll find the post that&#8217;s already displayed by the first query, and display it unless you tell it not to.)</p>
<p>An alternate version to this is to simply use &#8220;offset&#8221; &#8211; then if you&#8217;re displaying the first post from a category in the first query, you can just &#8220;offset=1&#8243; in the second, and it&#8217;ll just skip the first post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Monkeytail</title>
		<link>http://brassblogs.com/cms-platforms/wordpress/creating-wordpress-themes-query_posts#comment-173</link>
		<dc:creator>Monkeytail</dc:creator>
		<pubDate>Tue, 04 Aug 2009 00:07:08 +0000</pubDate>
		<guid isPermaLink="false">http://brassblogs.com/?p=141#comment-173</guid>
		<description>Nice!
Why would you opt for the $post-&gt;ID way when youre passing the same argument - as the non $post-&gt;ID  version - to the WP_Query constructor</description>
		<content:encoded><![CDATA[<p>Nice!<br />
Why would you opt for the $post-&gt;ID way when youre passing the same argument &#8211; as the non $post-&gt;ID  version &#8211; to the WP_Query constructor</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: João Nunes</title>
		<link>http://brassblogs.com/cms-platforms/wordpress/creating-wordpress-themes-query_posts#comment-171</link>
		<dc:creator>João Nunes</dc:creator>
		<pubDate>Sat, 01 Aug 2009 04:33:35 +0000</pubDate>
		<guid isPermaLink="false">http://brassblogs.com/?p=141#comment-171</guid>
		<description>Sensational post. It solved exactly the problem I was having in my index page, where I am mixing the two kinds of loops. Thank you so much,
João</description>
		<content:encoded><![CDATA[<p>Sensational post. It solved exactly the problem I was having in my index page, where I am mixing the two kinds of loops. Thank you so much,<br />
João</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: links for 2009-07-20 &#124; Digital Rehab</title>
		<link>http://brassblogs.com/cms-platforms/wordpress/creating-wordpress-themes-query_posts#comment-162</link>
		<dc:creator>links for 2009-07-20 &#124; Digital Rehab</dc:creator>
		<pubDate>Tue, 21 Jul 2009 00:38:29 +0000</pubDate>
		<guid isPermaLink="false">http://brassblogs.com/?p=141#comment-162</guid>
		<description>[...] Creating WordPress Themes: query_posts(); &#124; Brass Blogs Web Design (tags: wordpress development theme webdev loop) [...]</description>
		<content:encoded><![CDATA[<p>[...] Creating WordPress Themes: query_posts(); | Brass Blogs Web Design (tags: wordpress development theme webdev loop) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shelly</title>
		<link>http://brassblogs.com/cms-platforms/wordpress/creating-wordpress-themes-query_posts#comment-140</link>
		<dc:creator>Shelly</dc:creator>
		<pubDate>Sat, 20 Jun 2009 13:48:24 +0000</pubDate>
		<guid isPermaLink="false">http://brassblogs.com/?p=141#comment-140</guid>
		<description>Yes, it&#039;s the same principles as above.  There&#039;s a couple of ways to do it - the simplest would probably be to use *two* queries - one for the first two and a second for the following three.  But the most *efficient* method would be to  do a single query and pull in the 5 posts, and use the count method to use a flag so the display is edited.  For example, say you want category 3 to be the posts you pull.  You&#039;d do this:
&lt;code&gt;
&lt;?php $cat = new WP_Query(&#039;cat=3&amp;showposts=5&#039;);
$count = 1;
if($cat-&gt;have_posts()) : while($cat-&gt;have_posts()) : $cat-&gt;the_post();
$no_duplicate = $post-&gt;ID;
&lt;/code&gt;&lt;code&gt;
if ($count &lt;= &quot;2&quot;) { ?&gt;
&lt;/code&gt;&lt;code&gt;
do your layout code with the excerpt for the first 2 posts
&lt;/code&gt;&lt;code&gt;
&lt;?php } else { ?&gt;
&lt;/code&gt;&lt;code&gt;
do your layout for the titles only
&lt;/code&gt;&lt;code&gt;
&lt;?php $count++; endwhile; endif; ?&gt;
&lt;/code&gt;

That basically counts each post that you&#039;re pulling in, and if the count is &quot;1&quot; or &quot;2&quot;, then it&#039;ll output your layout with the excerpt, but if it&#039;s not, it&#039;ll do titles only.

Just so you know, that&#039;s off the top of my head, so I might have a typo or two in there, but I&#039;ve used a similar method to insert stuff between posts (like ads, line breaks, etc.) so I do know it works.  This is actually something i plan to cover in detail in a post that coming soon, as well - but that should get you started :)</description>
		<content:encoded><![CDATA[<p>Yes, it&#8217;s the same principles as above.  There&#8217;s a couple of ways to do it &#8211; the simplest would probably be to use *two* queries &#8211; one for the first two and a second for the following three.  But the most *efficient* method would be to  do a single query and pull in the 5 posts, and use the count method to use a flag so the display is edited.  For example, say you want category 3 to be the posts you pull.  You&#8217;d do this:<br />
<code><br />
&lt;?php $cat = new WP_Query('cat=3&#038;showposts=5');<br />
$count = 1;<br />
if($cat->have_posts()) : while($cat->have_posts()) : $cat->the_post();<br />
$no_duplicate = $post->ID;<br />
</code><code><br />
if ($count < = "2") { ?><br />
</code><code><br />
do your layout code with the excerpt for the first 2 posts<br />
</code><code><br />
&lt;?php } else { ?><br />
</code><code><br />
do your layout for the titles only<br />
</code><code><br />
&lt;?php $count++; endwhile; endif; ?><br />
</code></p>
<p>That basically counts each post that you&#8217;re pulling in, and if the count is &#8220;1&#8243; or &#8220;2&#8243;, then it&#8217;ll output your layout with the excerpt, but if it&#8217;s not, it&#8217;ll do titles only.</p>
<p>Just so you know, that&#8217;s off the top of my head, so I might have a typo or two in there, but I&#8217;ve used a similar method to insert stuff between posts (like ads, line breaks, etc.) so I do know it works.  This is actually something i plan to cover in detail in a post that coming soon, as well &#8211; but that should get you started <img src='http://brassblogs.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh</title>
		<link>http://brassblogs.com/cms-platforms/wordpress/creating-wordpress-themes-query_posts#comment-139</link>
		<dc:creator>Josh</dc:creator>
		<pubDate>Thu, 18 Jun 2009 17:37:27 +0000</pubDate>
		<guid isPermaLink="false">http://brassblogs.com/?p=141#comment-139</guid>
		<description>Great post!!!

Would you know how to grab the two most recent posts (with excerpt), then show the next three post titles (Just the Titles)?

Thank you!</description>
		<content:encoded><![CDATA[<p>Great post!!!</p>
<p>Would you know how to grab the two most recent posts (with excerpt), then show the next three post titles (Just the Titles)?</p>
<p>Thank you!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mint</title>
		<link>http://brassblogs.com/cms-platforms/wordpress/creating-wordpress-themes-query_posts#comment-97</link>
		<dc:creator>mint</dc:creator>
		<pubDate>Sun, 03 May 2009 04:58:43 +0000</pubDate>
		<guid isPermaLink="false">http://brassblogs.com/?p=141#comment-97</guid>
		<description>your‘s post is very neat &amp; serious.
i have subscribed it.thank you of your hard work.</description>
		<content:encoded><![CDATA[<p>your‘s post is very neat &amp; serious.<br />
i have subscribed it.thank you of your hard work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Creating WordPress Themes: Front Page Styling &#124; Brass Blogs Web Design</title>
		<link>http://brassblogs.com/cms-platforms/wordpress/creating-wordpress-themes-query_posts#comment-95</link>
		<dc:creator>Creating WordPress Themes: Front Page Styling &#124; Brass Blogs Web Design</dc:creator>
		<pubDate>Tue, 28 Apr 2009 13:23:03 +0000</pubDate>
		<guid isPermaLink="false">http://brassblogs.com/?p=141#comment-95</guid>
		<description>[...] Up next: Pull in Specific Content to the Index Page [...]</description>
		<content:encoded><![CDATA[<p>[...] Up next: Pull in Specific Content to the Index Page [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
