<?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>Digging into WordPress &#187; copyright</title>
	<atom:link href="http://digwp.com/tag/copyright/feed/" rel="self" type="application/rss+xml" />
	<link>http://digwp.com</link>
	<description>Take your WordPress skills to the next level.</description>
	<lastBuildDate>Thu, 09 Feb 2012 19:03:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How to Display a Copyright as a Range of Dates</title>
		<link>http://digwp.com/2009/08/range-copyright-dates/</link>
		<comments>http://digwp.com/2009/08/range-copyright-dates/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 06:06:44 +0000</pubDate>
		<dc:creator>Jeff Starr</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[copyright]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[echo]]></category>
		<category><![CDATA[footer]]></category>

		<guid isPermaLink="false">http://digwp.com/?p=604</guid>
		<description><![CDATA[Technically, your work is protected under copyright &#8220;the moment it is created and fixed in a tangible form that it is perceptible either directly or with the aid of a machine or device.&#8221; [1] Registration of your copyrighted work is not required [2], but you should include a copyright notice on all published works [3]. [...]]]></description>
			<content:encoded><![CDATA[<p>Technically, your work is protected under copyright &ldquo;the moment it is created and fixed in a tangible form that it is perceptible either directly or with the aid of a machine or device.&rdquo; <small>[1]</small> Registration of your copyrighted work is not required <small>[2]</small>, but <strong>you should include a copyright notice on all published works</strong> <small>[3]</small>. </p>
<p><a href="http://digwp.com/2009/05/dynamic-copyright-in-your-wordpress-footer/" title="Dynamic Copyright in your WordPress Footer">Displaying a copyright statement in the footer of your web pages</a> is easily done with something like this:</p>
<p><span id="more-604"></span></p>
<pre><code>Copyright &amp;copy; &lt;?php echo date('Y'); ?&gt; Digging into WordPress</code></pre>
<p>This code will output the following text:</p>
<p>Copyright &copy; 2009 Digging into WordPress</p>
<p>I think most of us are familiar with this technique, as it would be a total pain to <em>manually</em> update the copyright date on all of your sites <em>every</em> year. </p>
<p>But what if you want to display your site&rsquo;s copyright statement as a range of dates instead of just the current year? Many sites do this, and I am guessing that they do something like this in their source code:</p>
<pre><code>Copyright &amp;copy; 2008 - &lt;?php echo date('Y'); ?&gt; Digging into WordPress</code></pre>
<p>While this method certainly works, it would be better to automate the process and have the range of dates displayed dynamically. This would be especially helpful for publicly released themes, where you want to minimize the amount of &ldquo;fiddling&rdquo; involved with the setup and configuration process.</p>
<p>To display a copyright as a range of dates for your theme, add the following function to your theme&rsquo;s <code>functions.php</code> file:</p>
<pre><code>&lt;?php // display range of dates for copyright @ digwp.com
function copyrightDate() {
	global $wpdb;
	$copyright_dates = $wpdb-&gt;get_results("
		SELECT 
			YEAR(min(post_date_gmt)) AS firstdate, 
			YEAR(max(post_date_gmt)) AS lastdate 
		FROM 
			$wpdb-&gt;posts
	");
	if($copyright_dates) {
		$copyright = "Copyright &amp;copy; " . $copyright_dates[0]-&gt;firstdate;
		if($copyright_dates[0]-&gt;firstdate != $copyright_dates[0]-&gt;lastdate) {
			$copyright .= '-' . $copyright_dates[0]-&gt;lastdate;
		}
		echo $copyright . "&amp;nbsp;" . get_bloginfo('name');
	}
}
add_filter('wp_footer', 'copyrightDate');
?&gt;</code></pre>
<p>That&rsquo;s all there is to it. Nothing else needs to be done in order for this code to output the something similar to the following:</p>
<p>Copyright &copy; 2008-2009 Digging into WordPress</p>
<p>If your site is less than a year old, the function will simply print a single-year copyright date:</p>
<p>Copyright &copy; 2009 Digging into WordPress</p>
<p>By default, this function will display this information wherever the following hook is located in your theme:</p>
<pre><code>&lt;?php wp_footer(); ?&gt;</code></pre>
<p>If this hook is not present, of if you would like to customize the location of the copyright statement, simply call the function anywhere in your theme with the following tag:</p>
<pre><code>&lt;?php copyrightDate(); ?&gt;</code></pre>
<p>Depending on your theme setup, if you call the function directly, you may want to comment out the last line (i.e., <code>add_filter()</code>) in the function itself to prevent duplicate output.</p>
<h4>References</h4>
<p>[1] <a href="http://www.copyright.gov/help/faq/faq-general.html" title="Copyright in General">http://www.copyright.gov/help/faq/faq-general.html</a><br />
[2] Unless you wish to bring a lawsuit for infringement of a U.S. work.<br />
[3] Source: <a href="http://www.entrepreneurpress.com/cgi-bin/books/00320.html" title="Business &#038; Small Business Bookstore - Intellectual Property - Entrepreneurpress.com">Intellectual Property: Patents, Trademarks, Copyrights and Trade Secrets</a></p>
<hr />
<p><small>© 2009 <a href="http://digwp.com">Digging into WordPress</a> | <a href="http://digwp.com/2009/08/range-copyright-dates/">Permalink</a> | <a href="http://digwp.com/2009/08/range-copyright-dates/#comments">12 comments</a> | Add to <a href="http://del.icio.us/post?url=http://digwp.com/2009/08/range-copyright-dates/&title=How to Display a Copyright as a Range of Dates">del.icio.us</a> | Post tags: <a href="http://digwp.com/tag/copyright/" rel="tag">copyright</a>, <a href="http://digwp.com/tag/date/" rel="tag">date</a>, <a href="http://digwp.com/tag/echo/" rel="tag">echo</a>, <a href="http://digwp.com/tag/footer/" rel="tag">footer</a><br/></small></p>]]></content:encoded>
			<wfw:commentRss>http://digwp.com/2009/08/range-copyright-dates/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Dynamic Copyright in your WordPress Footer</title>
		<link>http://digwp.com/2009/05/dynamic-copyright-in-your-wordpress-footer/</link>
		<comments>http://digwp.com/2009/05/dynamic-copyright-in-your-wordpress-footer/#comments</comments>
		<pubDate>Fri, 29 May 2009 23:44:16 +0000</pubDate>
		<dc:creator>Chris Coyier</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[copyright]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[echo]]></category>
		<category><![CDATA[footer]]></category>

		<guid isPermaLink="false">http://modernwordpress.com/?p=13</guid>
		<description><![CDATA[Many footers on websites contain text like &#8220;&#169; 2009 Your Website&#8221;. A good measure, surely. We can use some classic PHP and a built-in WordPress function to make this bit of text dynamic so that it will never need to be tampered with manually again. &#60;p&#62; &#38;copy; &#60;?php echo date("Y"); echo " "; echo bloginfo('name'); [...]]]></description>
			<content:encoded><![CDATA[<p>Many footers on websites contain text like &#8220;&copy; 2009 Your Website&#8221;. A good measure, surely. We can use some classic PHP and a built-in WordPress function to make this bit of text dynamic so that it will never need to be tampered with manually again.</p>
<pre><code>&lt;p&gt;
   &amp;copy; &lt;?php echo date("Y"); echo " "; echo bloginfo('name'); ?&gt;
&lt;/p&gt;</code></pre>
<p>The year will always be the current year, based on your server&#8217;s set time. The text will come directly from the Blog Title setting in <code>Settings &gt; General</code>.</p>
<hr />
<p><small>© 2009 <a href="http://digwp.com">Digging into WordPress</a> | <a href="http://digwp.com/2009/05/dynamic-copyright-in-your-wordpress-footer/">Permalink</a> | <a href="http://digwp.com/2009/05/dynamic-copyright-in-your-wordpress-footer/#comments">3 comments</a> | Add to <a href="http://del.icio.us/post?url=http://digwp.com/2009/05/dynamic-copyright-in-your-wordpress-footer/&title=Dynamic Copyright in your WordPress Footer">del.icio.us</a> | Post tags: <a href="http://digwp.com/tag/copyright/" rel="tag">copyright</a>, <a href="http://digwp.com/tag/date/" rel="tag">date</a>, <a href="http://digwp.com/tag/echo/" rel="tag">echo</a>, <a href="http://digwp.com/tag/footer/" rel="tag">footer</a><br/></small></p>]]></content:encoded>
			<wfw:commentRss>http://digwp.com/2009/05/dynamic-copyright-in-your-wordpress-footer/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

