<?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"
	>
<channel>
	<title>Comments on: Hiding Advertisements For Single Posts</title>
	<atom:link href="http://weblogtoolscollection.com/archives/2008/06/11/hiding-advertisements-for-single-posts/feed/" rel="self" type="application/rss+xml" />
	<link>http://weblogtoolscollection.com/archives/2008/06/11/hiding-advertisements-for-single-posts/</link>
	<description>Weblog Tools Blogging Tools Blog</description>
	<pubDate>Fri, 09 Jan 2009 04:41:56 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.5</generator>
		<item>
		<title>By: Wordpress Hacks, Guides and Tricks &#124; TechnoBuzz.net</title>
		<link>http://weblogtoolscollection.com/archives/2008/06/11/hiding-advertisements-for-single-posts/#comment-1235251</link>
		<dc:creator>Wordpress Hacks, Guides and Tricks &#124; TechnoBuzz.net</dc:creator>
		<pubDate>Sun, 17 Aug 2008 08:36:50 +0000</pubDate>
		<guid isPermaLink="false">http://weblogtoolscollection.com/?p=3631#comment-1235251</guid>
		<description>[...] 15. Hiding Advertisements For Single Posts [...]</description>
		<content:encoded><![CDATA[<p>[...] 15. Hiding Advertisements For Single Posts [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 25 Brilliant WordPress Tricks and Plugins to Make Your Blog Stand Out &#124; Oragle</title>
		<link>http://weblogtoolscollection.com/archives/2008/06/11/hiding-advertisements-for-single-posts/#comment-1234539</link>
		<dc:creator>25 Brilliant WordPress Tricks and Plugins to Make Your Blog Stand Out &#124; Oragle</dc:creator>
		<pubDate>Tue, 05 Aug 2008 19:00:28 +0000</pubDate>
		<guid isPermaLink="false">http://weblogtoolscollection.com/?p=3631#comment-1234539</guid>
		<description>[...] 16. Hide Ads for Single Posts So, your visitors are annoyed because of the 1,000s of popups or ads they get when viewing a post. Fix that! Homepage [...]</description>
		<content:encoded><![CDATA[<p>[...] 16. Hide Ads for Single Posts So, your visitors are annoyed because of the 1,000s of popups or ads they get when viewing a post. Fix that! Homepage [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Los 40 trucos mas importantes de Wordpress « Camyna.com</title>
		<link>http://weblogtoolscollection.com/archives/2008/06/11/hiding-advertisements-for-single-posts/#comment-1233525</link>
		<dc:creator>Los 40 trucos mas importantes de Wordpress « Camyna.com</dc:creator>
		<pubDate>Thu, 17 Jul 2008 08:58:22 +0000</pubDate>
		<guid isPermaLink="false">http://weblogtoolscollection.com/?p=3631#comment-1233525</guid>
		<description>[...] Esconde la publicidad en los posts [...]</description>
		<content:encoded><![CDATA[<p>[...] Esconde la publicidad en los posts [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Antibioticos &#171; SoLo Se Que No Se NaDa</title>
		<link>http://weblogtoolscollection.com/archives/2008/06/11/hiding-advertisements-for-single-posts/#comment-1232711</link>
		<dc:creator>Antibioticos &#171; SoLo Se Que No Se NaDa</dc:creator>
		<pubDate>Fri, 04 Jul 2008 00:06:28 +0000</pubDate>
		<guid isPermaLink="false">http://weblogtoolscollection.com/?p=3631#comment-1232711</guid>
		<description>[...] Ocultar anuncios para ciertos posts en particular, ver cómo. [...]</description>
		<content:encoded><![CDATA[<p>[...] Ocultar anuncios para ciertos posts en particular, ver cómo. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 40+ Most Wanted WordPress Tricks and Hacks &#124; Blogging Tips</title>
		<link>http://weblogtoolscollection.com/archives/2008/06/11/hiding-advertisements-for-single-posts/#comment-1231942</link>
		<dc:creator>40+ Most Wanted WordPress Tricks and Hacks &#124; Blogging Tips</dc:creator>
		<pubDate>Fri, 27 Jun 2008 06:40:21 +0000</pubDate>
		<guid isPermaLink="false">http://weblogtoolscollection.com/?p=3631#comment-1231942</guid>
		<description>[...] Hiding Advertisements For Single Posts [...]</description>
		<content:encoded><![CDATA[<p>[...] Hiding Advertisements For Single Posts [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mas de 40 trucos y hackeos para Wordpress &#124; Pboza</title>
		<link>http://weblogtoolscollection.com/archives/2008/06/11/hiding-advertisements-for-single-posts/#comment-1231582</link>
		<dc:creator>Mas de 40 trucos y hackeos para Wordpress &#124; Pboza</dc:creator>
		<pubDate>Wed, 25 Jun 2008 05:04:23 +0000</pubDate>
		<guid isPermaLink="false">http://weblogtoolscollection.com/?p=3631#comment-1231582</guid>
		<description>[...] 11. Esconder los anuncios de artículos simples [...]</description>
		<content:encoded><![CDATA[<p>[...] 11. Esconder los anuncios de artículos simples [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 40 consejos y trucos para Wordpress &#124; aNieto2K</title>
		<link>http://weblogtoolscollection.com/archives/2008/06/11/hiding-advertisements-for-single-posts/#comment-1231340</link>
		<dc:creator>40 consejos y trucos para Wordpress &#124; aNieto2K</dc:creator>
		<pubDate>Mon, 23 Jun 2008 16:04:54 +0000</pubDate>
		<guid isPermaLink="false">http://weblogtoolscollection.com/?p=3631#comment-1231340</guid>
		<description>[...] Esconde la publicidad en los posts [...]</description>
		<content:encoded><![CDATA[<p>[...] Esconde la publicidad en los posts [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cool coding tips from around your WordPress community - part 1 &#8212; WP Project</title>
		<link>http://weblogtoolscollection.com/archives/2008/06/11/hiding-advertisements-for-single-posts/#comment-1230762</link>
		<dc:creator>Cool coding tips from around your WordPress community - part 1 &#8212; WP Project</dc:creator>
		<pubDate>Thu, 19 Jun 2008 06:05:05 +0000</pubDate>
		<guid isPermaLink="false">http://weblogtoolscollection.com/?p=3631#comment-1230762</guid>
		<description>[...] Dsouza shows us a simple way to skip ads on a single post. The condition we will be using is quite simple and will fulfill the following statement, ” if [...]</description>
		<content:encoded><![CDATA[<p>[...] Dsouza shows us a simple way to skip ads on a single post. The condition we will be using is quite simple and will fulfill the following statement, ” if [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 40+ Most Wanted Wordpress Tricks and Hacks</title>
		<link>http://weblogtoolscollection.com/archives/2008/06/11/hiding-advertisements-for-single-posts/#comment-1230099</link>
		<dc:creator>40+ Most Wanted Wordpress Tricks and Hacks</dc:creator>
		<pubDate>Sun, 15 Jun 2008 10:52:18 +0000</pubDate>
		<guid isPermaLink="false">http://weblogtoolscollection.com/?p=3631#comment-1230099</guid>
		<description>[...] Hiding Advertisements For Single Posts [...]</description>
		<content:encoded><![CDATA[<p>[...] Hiding Advertisements For Single Posts [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nouman</title>
		<link>http://weblogtoolscollection.com/archives/2008/06/11/hiding-advertisements-for-single-posts/#comment-1230055</link>
		<dc:creator>Nouman</dc:creator>
		<pubDate>Sun, 15 Jun 2008 04:21:19 +0000</pubDate>
		<guid isPermaLink="false">http://weblogtoolscollection.com/?p=3631#comment-1230055</guid>
		<description>I have tried this code to my single.php but it is not working in either way i dont know what is wrong with this can anyone help me to solve out this issue..</description>
		<content:encoded><![CDATA[<p>I have tried this code to my single.php but it is not working in either way i dont know what is wrong with this can anyone help me to solve out this issue..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: How To: Skip Advertisements on Single Posts</title>
		<link>http://weblogtoolscollection.com/archives/2008/06/11/hiding-advertisements-for-single-posts/#comment-1229898</link>
		<dc:creator>How To: Skip Advertisements on Single Posts</dc:creator>
		<pubDate>Sat, 14 Jun 2008 08:00:34 +0000</pubDate>
		<guid isPermaLink="false">http://weblogtoolscollection.com/?p=3631#comment-1229898</guid>
		<description>[...] ID&#8217;s, our friend Keith has posted over at Weblog Tools Collection an easy to follow guide on how to skip advertisements on single posts of your choice.  You just need to know the post ID&#8217;s and add a small PHP snippet around the [...]</description>
		<content:encoded><![CDATA[<p>[...] ID&#8217;s, our friend Keith has posted over at Weblog Tools Collection an easy to follow guide on how to skip advertisements on single posts of your choice.  You just need to know the post ID&#8217;s and add a small PHP snippet around the [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JD Hartley</title>
		<link>http://weblogtoolscollection.com/archives/2008/06/11/hiding-advertisements-for-single-posts/#comment-1229834</link>
		<dc:creator>JD Hartley</dc:creator>
		<pubDate>Fri, 13 Jun 2008 17:36:29 +0000</pubDate>
		<guid isPermaLink="false">http://weblogtoolscollection.com/?p=3631#comment-1229834</guid>
		<description>Hmmm....alright. That does make more sense now.</description>
		<content:encoded><![CDATA[<p>Hmmm&#8230;.alright. That does make more sense now.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jamie</title>
		<link>http://weblogtoolscollection.com/archives/2008/06/11/hiding-advertisements-for-single-posts/#comment-1229831</link>
		<dc:creator>Jamie</dc:creator>
		<pubDate>Fri, 13 Jun 2008 15:14:29 +0000</pubDate>
		<guid isPermaLink="false">http://weblogtoolscollection.com/?p=3631#comment-1229831</guid>
		<description>&lt;i&gt;Both logically make sense, though.&lt;/i&gt;

I'm not trying to be awkward or obnoxious here, but no, they don't. If they did, why would two different operators exist? OR and AND don't mean the same thing.

&lt;i&gt;if [id] doesn’t equal 1 OR if [id] doesn’t equal 5&lt;/i&gt;

Right, think about that. If it doesn't equal 1 &lt;i&gt;or&lt;/i&gt; it doesn't equal 5. &lt;b&gt;1 doesn't equal 5&lt;/b&gt;, so it meets one of the two OR conditions. Since the entire definition of OR is that it only needs to meet one of them, an ad will display.

OR would only work here if you were trying to use positive conditions -- i.e. "if ID &lt;i&gt;does&lt;/i&gt; equal 1 or it &lt;i&gt;does&lt;/i&gt; equal 5, then don't show an ad". (Conversely, if you were doing it that way, you could not use AND. They're not interchangeable.)

As other people have pointed out, there are probably better ways of doing this, but all I'm trying to show is that if users see this post and use the code Keith provided, it won't work.</description>
		<content:encoded><![CDATA[<p><i>Both logically make sense, though.</i></p>
<p>I&#8217;m not trying to be awkward or obnoxious here, but no, they don&#8217;t. If they did, why would two different operators exist? OR and AND don&#8217;t mean the same thing.</p>
<p><i>if [id] doesn’t equal 1 OR if [id] doesn’t equal 5</i></p>
<p>Right, think about that. If it doesn&#8217;t equal 1 <i>or</i> it doesn&#8217;t equal 5. <b>1 doesn&#8217;t equal 5</b>, so it meets one of the two OR conditions. Since the entire definition of OR is that it only needs to meet one of them, an ad will display.</p>
<p>OR would only work here if you were trying to use positive conditions &#8212; i.e. &#8220;if ID <i>does</i> equal 1 or it <i>does</i> equal 5, then don&#8217;t show an ad&#8221;. (Conversely, if you were doing it that way, you could not use AND. They&#8217;re not interchangeable.)</p>
<p>As other people have pointed out, there are probably better ways of doing this, but all I&#8217;m trying to show is that if users see this post and use the code Keith provided, it won&#8217;t work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JD Hartley</title>
		<link>http://weblogtoolscollection.com/archives/2008/06/11/hiding-advertisements-for-single-posts/#comment-1229795</link>
		<dc:creator>JD Hartley</dc:creator>
		<pubDate>Fri, 13 Jun 2008 03:18:00 +0000</pubDate>
		<guid isPermaLink="false">http://weblogtoolscollection.com/?p=3631#comment-1229795</guid>
		<description>Jamie,

It is a little late for me to be testing it out myself (I should be heading to bed sometime soon). Both logically make sense, though.

if [id] doesn't equal 1 OR if [id] doesn't equal 5

If ID equals 2, it will be true. If it is 1, it still will return as false because of the OR statement.

The exact same thing will go for if it is an AND statement. I am not sure why it isn't working how it is suppose to on your install. I could be wrong, of course, but it doesn't make sense to me why this isn't working correctly. Maybe it's just me....

Anyone else have any insight on this? Maybe a third opinion will help clear it up.

-JD</description>
		<content:encoded><![CDATA[<p>Jamie,</p>
<p>It is a little late for me to be testing it out myself (I should be heading to bed sometime soon). Both logically make sense, though.</p>
<p>if [id] doesn&#8217;t equal 1 OR if [id] doesn&#8217;t equal 5</p>
<p>If ID equals 2, it will be true. If it is 1, it still will return as false because of the OR statement.</p>
<p>The exact same thing will go for if it is an AND statement. I am not sure why it isn&#8217;t working how it is suppose to on your install. I could be wrong, of course, but it doesn&#8217;t make sense to me why this isn&#8217;t working correctly. Maybe it&#8217;s just me&#8230;.</p>
<p>Anyone else have any insight on this? Maybe a third opinion will help clear it up.</p>
<p>-JD</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frederick</title>
		<link>http://weblogtoolscollection.com/archives/2008/06/11/hiding-advertisements-for-single-posts/#comment-1229783</link>
		<dc:creator>Frederick</dc:creator>
		<pubDate>Thu, 12 Jun 2008 21:20:43 +0000</pubDate>
		<guid isPermaLink="false">http://weblogtoolscollection.com/?p=3631#comment-1229783</guid>
		<description>@ChaosKaizer: Right, your first piece of code would have searched for the ID in the index; I guess your second piece of code would work.

My question is, is it more efficient to use isset() with an array key than to use in_array()?</description>
		<content:encoded><![CDATA[<p>@ChaosKaizer: Right, your first piece of code would have searched for the ID in the index; I guess your second piece of code would work.</p>
<p>My question is, is it more efficient to use isset() with an array key than to use in_array()?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jamie</title>
		<link>http://weblogtoolscollection.com/archives/2008/06/11/hiding-advertisements-for-single-posts/#comment-1229778</link>
		<dc:creator>Jamie</dc:creator>
		<pubDate>Thu, 12 Jun 2008 18:47:59 +0000</pubDate>
		<guid isPermaLink="false">http://weblogtoolscollection.com/?p=3631#comment-1229778</guid>
		<description>Oops, of course on that second snippet I meant

&lt;blockquote&gt;
If I change it to

&lt;code&gt;if(get_the_ID() != 1 &lt;b&gt;&#38;&#38;&lt;/b&gt; get_the_ID() != 5)&lt;/code&gt;
&lt;/blockquote&gt;</description>
		<content:encoded><![CDATA[<p>Oops, of course on that second snippet I meant</p>
<blockquote><p>
If I change it to</p>
<p><code>if(get_the_ID() != 1 <b>&amp;&amp;</b> get_the_ID() != 5)</code>
</p></blockquote>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jamie</title>
		<link>http://weblogtoolscollection.com/archives/2008/06/11/hiding-advertisements-for-single-posts/#comment-1229777</link>
		<dc:creator>Jamie</dc:creator>
		<pubDate>Thu, 12 Jun 2008 18:45:37 +0000</pubDate>
		<guid isPermaLink="false">http://weblogtoolscollection.com/?p=3631#comment-1229777</guid>
		<description>I just tested in my own test blog to make sure I wasn't crazy (or suffering from lack of caffeine). I used the following in single.php:

&lt;code&gt;
if(get_the_ID() != 1 &#124;&#124; get_the_ID() != 5) { 
echo '
&#60;div&#62; [Your Advertisement Code] &#60;/div&#62;
';
}
&lt;/code&gt;

(1 and 5 are actual existing post IDs.)

And as I expected, "[Your Ad Code]" appeared on &lt;b&gt;all&lt;/b&gt; posts, &lt;i&gt;including&lt;/i&gt; 1 and 5.

If I change it to 

&lt;code&gt;if(get_the_ID() != 1 &#124;&#124; get_the_ID() != 5)&lt;/code&gt;

then, as I expected, "[Your Ad]" does &lt;i&gt;not&lt;/i&gt; appear on either post 1 or post 5, but does appear on all other posts.

Maybe I didn't explain it very well, but seriously, try it out for yourself. The OR condition works exactly as I (perhaps incoherently) described. It's not a matter of preference, it just will not work here. The only post that would NOT show ads if you used this code with the OR operator is a post that matches &lt;i&gt;both&lt;/i&gt; ID numbers, and of course there is no such post, so they will all show ads.</description>
		<content:encoded><![CDATA[<p>I just tested in my own test blog to make sure I wasn&#8217;t crazy (or suffering from lack of caffeine). I used the following in single.php:</p>
<p><code><br />
if(get_the_ID() != 1 || get_the_ID() != 5) {<br />
echo '<br />
&lt;div&gt; [Your Advertisement Code] &lt;/div&gt;<br />
&#8216;;<br />
}<br />
</code></p>
<p>(1 and 5 are actual existing post IDs.)</p>
<p>And as I expected, &#8220;[Your Ad Code]&#8221; appeared on <b>all</b> posts, <i>including</i> 1 and 5.</p>
<p>If I change it to </p>
<p><code>if(get_the_ID() != 1 || get_the_ID() != 5)</code></p>
<p>then, as I expected, &#8220;[Your Ad]&#8221; does <i>not</i> appear on either post 1 or post 5, but does appear on all other posts.</p>
<p>Maybe I didn&#8217;t explain it very well, but seriously, try it out for yourself. The OR condition works exactly as I (perhaps incoherently) described. It&#8217;s not a matter of preference, it just will not work here. The only post that would NOT show ads if you used this code with the OR operator is a post that matches <i>both</i> ID numbers, and of course there is no such post, so they will all show ads.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JD Hartley</title>
		<link>http://weblogtoolscollection.com/archives/2008/06/11/hiding-advertisements-for-single-posts/#comment-1229775</link>
		<dc:creator>JD Hartley</dc:creator>
		<pubDate>Thu, 12 Jun 2008 17:37:31 +0000</pubDate>
		<guid isPermaLink="false">http://weblogtoolscollection.com/?p=3631#comment-1229775</guid>
		<description>Jamie,

Both logically work. I think most people here seem to refer using OR, but whatever. It really is all the same when it runs.</description>
		<content:encoded><![CDATA[<p>Jamie,</p>
<p>Both logically work. I think most people here seem to refer using OR, but whatever. It really is all the same when it runs.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jamie</title>
		<link>http://weblogtoolscollection.com/archives/2008/06/11/hiding-advertisements-for-single-posts/#comment-1229768</link>
		<dc:creator>Jamie</dc:creator>
		<pubDate>Thu, 12 Jun 2008 13:24:51 +0000</pubDate>
		<guid isPermaLink="false">http://weblogtoolscollection.com/?p=3631#comment-1229768</guid>
		<description>Um, maybe I haven't had enough coffee yet, but aside from the issue of whether this is the best way to do it, shouldn't it be an AND condition instead of OR?

Say there are 2 posts that you do not want ads on -- IDs 23 and 77. If you use your code:

if(get_the_ID() != 23 &#124;&#124; get_the_ID() != 77) 

You're saying "If this post is not #23 &lt;i&gt;or&lt;/i&gt; is it not #77, show an ad" -- which means that on both 23 and 77, it &lt;i&gt;will&lt;/i&gt; show an ad. There are 2 possible conditions under which you want no ad displayed: The state of not being 23, and the state of not being 77. The OR code requires that a post meet only &lt;i&gt;one&lt;/i&gt; of those conditions -- 23 gets an ad because it meets the condition of not being 77, and 77 gets an ad because it meets the condition of not being 23.

So if you do want to do it this way, you need the AND condition:

if(get_the_ID() != xx &#38;&#38; get_the_ID() != xx)

That way you're saying "If this post is not 23 &lt;i&gt;and&lt;/i&gt; it is not 77, show an ad" -- you're requiring that it meet both conditions: The state of not being 23 &lt;i&gt;and&lt;/i&gt; the state of not being 77.</description>
		<content:encoded><![CDATA[<p>Um, maybe I haven&#8217;t had enough coffee yet, but aside from the issue of whether this is the best way to do it, shouldn&#8217;t it be an AND condition instead of OR?</p>
<p>Say there are 2 posts that you do not want ads on &#8212; IDs 23 and 77. If you use your code:</p>
<p>if(get_the_ID() != 23 || get_the_ID() != 77) </p>
<p>You&#8217;re saying &#8220;If this post is not #23 <i>or</i> is it not #77, show an ad&#8221; &#8212; which means that on both 23 and 77, it <i>will</i> show an ad. There are 2 possible conditions under which you want no ad displayed: The state of not being 23, and the state of not being 77. The OR code requires that a post meet only <i>one</i> of those conditions &#8212; 23 gets an ad because it meets the condition of not being 77, and 77 gets an ad because it meets the condition of not being 23.</p>
<p>So if you do want to do it this way, you need the AND condition:</p>
<p>if(get_the_ID() != xx &amp;&amp; get_the_ID() != xx)</p>
<p>That way you&#8217;re saying &#8220;If this post is not 23 <i>and</i> it is not 77, show an ad&#8221; &#8212; you&#8217;re requiring that it meet both conditions: The state of not being 23 <i>and</i> the state of not being 77.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ChaosKaizer</title>
		<link>http://weblogtoolscollection.com/archives/2008/06/11/hiding-advertisements-for-single-posts/#comment-1229751</link>
		<dc:creator>ChaosKaizer</dc:creator>
		<pubDate>Thu, 12 Jun 2008 03:08:45 +0000</pubDate>
		<guid isPermaLink="false">http://weblogtoolscollection.com/?p=3631#comment-1229751</guid>
		<description>that was a mistake
&lt;code&gt;
$show_ads = array_flip(array(1,2));
if ( isset($show_ads[get_the_ID()]) ) {
	// show ads	
}
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>that was a mistake<br />
<code><br />
$show_ads = array_flip(array(1,2));<br />
if ( isset($show_ads[get_the_ID()]) ) {<br />
	// show ads<br />
}<br />
</code></p>
]]></content:encoded>
	</item>
</channel>
</rss>
