<?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>Magnus Jepson &#187; query_posts</title>
	<atom:link href="http://www.jepson.no/tag/query_posts/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jepson.no</link>
	<description>Web Designer, Co-Founder of WooThemes</description>
	<lastBuildDate>Wed, 14 Apr 2010 11:02:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to exclude specific tag from query_posts</title>
		<link>http://www.jepson.no/how-to-exclude-specific-tag-from-query_posts/</link>
		<comments>http://www.jepson.no/how-to-exclude-specific-tag-from-query_posts/#comments</comments>
		<pubDate>Thu, 23 Apr 2009 09:17:16 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[query_posts]]></category>
		<category><![CDATA[tag]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.jepson.no/?p=436</guid>
		<description><![CDATA[On the upcoming theme I&#8217;m working on I needed to have a featured section on the left side, and normal posts on the right. Usually I would put the featured posts in a category, and excluded that from the normal posts. But for the end user, it is much easier to just tag the posts [...]]]></description>
			<content:encoded><![CDATA[<p>On the <a href="http://img2.pict.com/9e/05/28/f31e70a628e0f46bdcee8e58fc/iaKGL/test25c225a0257c25c225a0just2520.png">upcoming theme</a> I&#8217;m working on I needed to have a featured section on the left side, and normal posts on the right. Usually I would put the featured posts in a category, and excluded that from the normal posts. But for the end user, it is much easier to just tag the posts they want to be featured with &#8220;featured&#8221;. That way they don&#8217;t have to create a category called featured, select that in the options panel etc.</p>
<p>It isn&#8217;t so <a href="http://codex.wordpress.org/Template_Tags/query_posts#Tag_Parameters">well documented</a>,  so after talking to Adii we came up with the following code that does the job perfectly for the right hand side normal posts:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">get_var<span class="br0">&#40;</span><span class="st0">&quot;SELECT term_ID FROM $wpdb-&gt;terms WHERE name=&#8217;featured&#8217;&quot;</span><span class="br0">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$paged</span> = <span class="br0">&#40;</span>get_query_var<span class="br0">&#40;</span><span class="st0">&#8216;paged&#8217;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> ? get_query_var<span class="br0">&#40;</span><span class="st0">&#8216;paged&#8217;</span><span class="br0">&#41;</span> : <span class="nu0">1</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$args</span>=<a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp;<span class="st0">&#8216;tag__not_in&#8217;</span> =&gt; <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="re0">$tag</span><span class="br0">&#41;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="st0">&#8216;paged&#8217;</span>=&gt;<span class="re0">$paged</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">query_posts<span class="br0">&#40;</span><span class="re0">$args</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">?&gt;</span></div>
</li>
</ol>
</div>
<p>The left side query is simple and just looks like this</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">&lt;?php</span> query_posts<span class="br0">&#40;</span><span class="st0">&#8216;tag=featured&#8217;</span><span class="br0">&#41;</span>; <span class="kw2">?&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.jepson.no/how-to-exclude-specific-tag-from-query_posts/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
