<?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: Exclude A Category From Turn Off Comments Automatically</title>
	<atom:link href="http://wpengineer.com/1944/exclude-category-from-turnoff-comments-automatically/feed/" rel="self" type="application/rss+xml" />
	<link>http://wpengineer.com/1944/exclude-category-from-turnoff-comments-automatically/</link>
	<description>WordPress News, Hacks, Tips, Tutorials, Plugins and Themes</description>
	<lastBuildDate>Wed, 08 Feb 2012 19:48:58 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Dan</title>
		<link>http://wpengineer.com/1944/exclude-category-from-turnoff-comments-automatically/#comment-5218</link>
		<dc:creator>Dan</dc:creator>
		<pubDate>Tue, 23 Nov 2010 04:55:36 +0000</pubDate>
		<guid isPermaLink="false">http://wpengineer.com/?p=1944#comment-5218</guid>
		<description>Hey, this looks great and should do exactly what I need it to. One question though, whenever I place it in my &#039;functions.php&#039; I get a parse error...?

Is there somewhere in particular where I should be placing it?</description>
		<content:encoded><![CDATA[<p>Hey, this looks great and should do exactly what I need it to. One question though, whenever I place it in my 'functions.php' I get a parse error...?</p>
<p>Is there somewhere in particular where I should be placing it?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ralph</title>
		<link>http://wpengineer.com/1944/exclude-category-from-turnoff-comments-automatically/#comment-4678</link>
		<dc:creator>Ralph</dc:creator>
		<pubDate>Tue, 20 Jul 2010 06:03:39 +0000</pubDate>
		<guid isPermaLink="false">http://wpengineer.com/?p=1944#comment-4678</guid>
		<description>I&#039;m trying to get this to work for allowing comments permanently on two categories, and not having success. I&#039;m confused on where you sub the $cat value - is it in the array definition or down in the add_filter function? Either way, comments stay off. How can I best troubleshoot this?</description>
		<content:encoded><![CDATA[<p>I'm trying to get this to work for allowing comments permanently on two categories, and not having success. I'm confused on where you sub the $cat value - is it in the array definition or down in the add_filter function? Either way, comments stay off. How can I best troubleshoot this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: phocean</title>
		<link>http://wpengineer.com/1944/exclude-category-from-turnoff-comments-automatically/#comment-4672</link>
		<dc:creator>phocean</dc:creator>
		<pubDate>Mon, 19 Jul 2010 02:44:15 +0000</pubDate>
		<guid isPermaLink="false">http://wpengineer.com/?p=1944#comment-4672</guid>
		<description>Hi,

I copied the code above in functions.php of my them, created a new template and affected it to the page where I want the comment to stay open.
Of course I updated the template name inside the function call.

But it does not work. Any suggestion please ? Is there any change that my theme ignore functions.php ?</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I copied the code above in functions.php of my them, created a new template and affected it to the page where I want the comment to stay open.<br />
Of course I updated the template name inside the function call.</p>
<p>But it does not work. Any suggestion please ? Is there any change that my theme ignore functions.php ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 11 Awesome Wordpress Development Blogs</title>
		<link>http://wpengineer.com/1944/exclude-category-from-turnoff-comments-automatically/#comment-4065</link>
		<dc:creator>11 Awesome Wordpress Development Blogs</dc:creator>
		<pubDate>Fri, 30 Apr 2010 18:47:48 +0000</pubDate>
		<guid isPermaLink="false">http://wpengineer.com/?p=1944#comment-4065</guid>
		<description>[...] neat posts: Build a Wordpress 2.8 Widget With the New Widget API Exclude a Category From &#8220;Turn Off Comments&#8221; Automatically. Display the Total Number of Registered Users RSS &#124; [...]</description>
		<content:encoded><![CDATA[<p>[...] neat posts: Build a WordPress 2.8 Widget With the New Widget API Exclude a Category From &#8220;Turn Off Comments&#8221; Automatically. Display the Total Number of Registered Users RSS | [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ahmad</title>
		<link>http://wpengineer.com/1944/exclude-category-from-turnoff-comments-automatically/#comment-3400</link>
		<dc:creator>ahmad</dc:creator>
		<pubDate>Thu, 04 Feb 2010 06:35:39 +0000</pubDate>
		<guid isPermaLink="false">http://wpengineer.com/?p=1944#comment-3400</guid>
		<description>Hi,

I loved the post very much.
I have a small blog and what I want is to allow comments Meta Tag on some categories and totally make the comments link or the comments box invisible in some categories.

Say I have 4 categories Google, Microsoft , yahoo, and Amazon. what I want is to remove comments box and link fully for category google &amp;  keep it visible for yahoo and others.

Looking for your help


Kind Regards,
Ahmad</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I loved the post very much.<br />
I have a small blog and what I want is to allow comments Meta Tag on some categories and totally make the comments link or the comments box invisible in some categories.</p>
<p>Say I have 4 categories Google, Microsoft , yahoo, and Amazon. what I want is to remove comments box and link fully for category google &amp;  keep it visible for yahoo and others.</p>
<p>Looking for your help</p>
<p>Kind Regards,<br />
Ahmad</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Coyier</title>
		<link>http://wpengineer.com/1944/exclude-category-from-turnoff-comments-automatically/#comment-3228</link>
		<dc:creator>Chris Coyier</dc:creator>
		<pubDate>Fri, 08 Jan 2010 04:58:18 +0000</pubDate>
		<guid isPermaLink="false">http://wpengineer.com/?p=1944#comment-3228</guid>
		<description>Yep that did the trick. I think it was pulling in that

global $wp_query;

that got the get_post_meta working.  

Excellent work guys, thanks!</description>
		<content:encoded><![CDATA[<p>Yep that did the trick. I think it was pulling in that</p>
<p>global $wp_query;</p>
<p>that got the get_post_meta working.  </p>
<p>Excellent work guys, thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://wpengineer.com/1944/exclude-category-from-turnoff-comments-automatically/#comment-3226</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Thu, 07 Jan 2010 22:12:44 +0000</pubDate>
		<guid isPermaLink="false">http://wpengineer.com/?p=1944#comment-3226</guid>
		<description>Here is the final working code for Chris Coyier&#039;s solution:
&lt;code&gt;
function wpe_close_comments_for_old_post( $open, $post_id, $template = &#039;page-snippet.php&#039;, $days_old = &#039;&#039; ) {
	global $wp_query;
	
	if( !$post_id )
		$post_id = $wp_query-&gt;post-&gt;ID;
 
	if ( get_post_meta($post_id, &#039;_wp_page_template&#039;, true) == $template &amp;&amp; get_option(&#039;close_comments_for_old_posts&#039;) ) {
		return !$open;
	}
	
	if ( !$open )
		return $open;
 
	if ( &#039;&#039; === $days_old )
		$days_old = (int) get_option(&#039;close_comments_days_old&#039;);
 
	if ( !$days_old )
		return $open;
 
	$post = get_post($post_id);
 
	if ( (time() - strtotime( $post-&gt;post_date_gmt )) &gt; ( $days_old * 24 * 60 * 60 ) )
		return false;
 
	return $open;
}
add_filter( &#039;comments_open&#039;, &#039;wpe_close_comments_for_old_post&#039;, 10, 2 );
add_filter( &#039;pings_open&#039;,    &#039;wpe_close_comments_for_old_post&#039;, 10, 2 );
&lt;/code&gt;

Thanks to &lt;a href=&quot;http://wpseek.com&quot; rel=&quot;nofollow&quot;&gt;Alphawolf&lt;/a&gt; for the final idea!</description>
		<content:encoded><![CDATA[<p>Here is the final working code for Chris Coyier's solution:<br />
<code><br />
function wpe_close_comments_for_old_post( $open, $post_id, $template = 'page-snippet.php', $days_old = '' ) {<br />
	global $wp_query;</code></p>
<p>	if( !$post_id )<br />
		$post_id = $wp_query->post->ID;</p>
<p>	if ( get_post_meta($post_id, '_wp_page_template', true) == $template &#038;& get_option('close_comments_for_old_posts') ) {<br />
		return !$open;<br />
	}</p>
<p>	if ( !$open )<br />
		return $open;</p>
<p>	if ( '' === $days_old )<br />
		$days_old = (int) get_option('close_comments_days_old');</p>
<p>	if ( !$days_old )<br />
		return $open;</p>
<p>	$post = get_post($post_id);</p>
<p>	if ( (time() - strtotime( $post->post_date_gmt )) > ( $days_old * 24 * 60 * 60 ) )<br />
		return false;</p>
<p>	return $open;<br />
}<br />
add_filter( 'comments_open', 'wpe_close_comments_for_old_post', 10, 2 );<br />
add_filter( 'pings_open',    'wpe_close_comments_for_old_post', 10, 2 );<br />
</p>
<p>Thanks to <a href="http://wpseek.com" rel="nofollow">Alphawolf</a> for the final idea!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Coyier</title>
		<link>http://wpengineer.com/1944/exclude-category-from-turnoff-comments-automatically/#comment-3224</link>
		<dc:creator>Chris Coyier</dc:creator>
		<pubDate>Thu, 07 Jan 2010 16:56:55 +0000</pubDate>
		<guid isPermaLink="false">http://wpengineer.com/?p=1944#comment-3224</guid>
		<description>As a test, I made the function just &quot;return true;&quot;, and indeed that did activate comments on all older content, so at least we can be sure the functions.php file is working and the filter is being applied properly. My theory is that the is_page_template and get_post_meta functions dont run properly in this context?</description>
		<content:encoded><![CDATA[<p>As a test, I made the function just "return true;", and indeed that did activate comments on all older content, so at least we can be sure the functions.php file is working and the filter is being applied properly. My theory is that the is_page_template and get_post_meta functions dont run properly in this context?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Coyier</title>
		<link>http://wpengineer.com/1944/exclude-category-from-turnoff-comments-automatically/#comment-3223</link>
		<dc:creator>Chris Coyier</dc:creator>
		<pubDate>Thu, 07 Jan 2010 15:25:02 +0000</pubDate>
		<guid isPermaLink="false">http://wpengineer.com/?p=1944#comment-3223</guid>
		<description>I gave it a shot but it&#039;s a no-go. Thanks for all the work on this though guys. I&#039;m sure it works great for categories =) It probably isn&#039;t destined to be for me.</description>
		<content:encoded><![CDATA[<p>I gave it a shot but it's a no-go. Thanks for all the work on this though guys. I'm sure it works great for categories =) It probably isn't destined to be for me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://wpengineer.com/1944/exclude-category-from-turnoff-comments-automatically/#comment-3222</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Wed, 06 Jan 2010 22:27:05 +0000</pubDate>
		<guid isPermaLink="false">http://wpengineer.com/?p=1944#comment-3222</guid>
		<description>Chris: Alphawolf and me working hard :p
&lt;code&gt;
if ( get_post_meta($post_id, &#039;_wp_page_template&#039;, true) == $template ) return open;
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Chris: Alphawolf and me working hard :p<br />
<code><br />
if ( get_post_meta($post_id, '_wp_page_template', true) == $template ) return open;<br />
</code></p>
]]></content:encoded>
	</item>
</channel>
</rss>

