<?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>WpFunc &#187; close</title>
	<atom:link href="http://wpfunc.com/tag/close/feed" rel="self" type="application/rss+xml" />
	<link>http://wpfunc.com</link>
	<description>Awesome, Quick, Simple WordPress Functions!</description>
	<lastBuildDate>Thu, 01 Dec 2011 01:17:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Disable Comments on 30-day older posts</title>
		<link>http://wpfunc.com/wordpress/disable-comments-on-30-day-older-posts.html</link>
		<comments>http://wpfunc.com/wordpress/disable-comments-on-30-day-older-posts.html#comments</comments>
		<pubDate>Sat, 18 Jul 2009 01:00:55 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[close]]></category>
		<category><![CDATA[commenting]]></category>
		<category><![CDATA[comments]]></category>
		<category><![CDATA[disable]]></category>
		<category><![CDATA[funcitons]]></category>

		<guid isPermaLink="false">http://www.wpfunc.com/?p=45</guid>
		<description><![CDATA[Hi! I have a new function for you :) That one about commenting and automatically closing comments. We can disable commenting on posts older then 30 days. We will change functions.php. Be careful please.

For disable commenting we have to make changes in functions.php in our theme folder. First, you have to make a backup for [...]]]></description>
			<content:encoded><![CDATA[<p>Hi! I have a new function for you :) That one about commenting and automatically closing comments. We can disable commenting on posts older then 30 days. We will change <strong><em>functions.php</em></strong>. Be careful please.<span id="more-45"></span></p>
<p style="text-align: justify;"><span class="alert"><strong>With this function/recipe you will change your functions.php file located in your theme folder. If you have no information about WordPress coding -so you&#8217;re a newbie- you can get some support if you send a mail to me. Don&#8217;t touch your functions.php if you don&#8217;t know about WordPress</strong></span></p>
<p>For disable commenting we have to make changes in <strong><em><span style="color: #ff0000;">functions.php</span></em></strong> in our theme folder. First, you have to make a backup for this file. After backup open your <strong><em>functions.php with your favourite php editor</em></strong> and add code to here.</p>
<h3>Here is th code;</h3>
<pre class="brush: plain; title: ; notranslate">&lt; ?php
function close_comments( $posts ) {
if ( !is_single() ) { return $posts; }
if ( time() - strtotime( $posts[0]-&gt;post_date_gmt ) &gt; ( 30 * 24 * 60 * 60 ) ) {
$posts[0]-&gt;comment_status = 'closed';
$posts[0]-&gt;ping_status    = 'closed';
}
return $posts;
}
add_filter( 'the_posts', 'close_comments' );
?&gt;</pre>
<p>The <span style="color: #ff0000;"><em><strong>30</strong></em></span> is day. If you change this value you can change disabling time.</p>
<p>That&#8217;s All! Have a nice day!</p>
]]></content:encoded>
			<wfw:commentRss>http://wpfunc.com/wordpress/disable-comments-on-30-day-older-posts.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

