<?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; footer</title>
	<atom:link href="http://digwp.com/tag/footer/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>Show Off Your WordPress Database Statistics</title>
		<link>http://digwp.com/2009/08/show-off-your-wordpress-database-statistics/</link>
		<comments>http://digwp.com/2009/08/show-off-your-wordpress-database-statistics/#comments</comments>
		<pubDate>Mon, 03 Aug 2009 06:08:45 +0000</pubDate>
		<dc:creator>Jeff Starr</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[footer]]></category>
		<category><![CDATA[statistics]]></category>
		<category><![CDATA[tricks]]></category>

		<guid isPermaLink="false">http://diggingintowordpress.com/?p=106</guid>
		<description><![CDATA[Did you know that WordPress makes it super-easy to display some basic statistics about your database performance? The information may be displayed publicly on your web page, slightly hidden in your source code, or entirely private so only you can see it. There are two basic statistics that are drop-dead easy to include on your [...]]]></description>
			<content:encoded><![CDATA[<p>Did you know that WordPress makes it super-easy to display some basic statistics about your database performance? The information may be displayed publicly on your web page, slightly hidden in your source code, or entirely private so only you can see it. There are two basic statistics that are drop-dead easy to include on your pages:</p>
<ul>
<li>The number of database queries that your page is making</li>
<li>How many seconds it took your server to complete those queries</li>
</ul>
<p>The number of database queries is generated from the following WordPress template tag:</p>
<p><code>&lt;?php echo get_num_queries(); ?&gt;</code></p>
<p><span id="more-106"></span></p>
<p>This is a very straightforward, parameter-less function that will output the number of database queries required to generate all of the dynamic content on your page. Then, the amount of time required to complete those &ldquo;x&rdquo; number of queries is provided by this template tag:</p>
<p><code>&lt;?php timer_stop(7); ?&gt;</code></p>
<p>As shown here, this function accepts a parameter that specifies the number of significant digits to be used for the output. Here, the number &ldquo;<code>7</code>&rdquo; tells the function to output the query-processing time to seven digits of accuracy. So we would see a number like this:</p>
<p><code>.0173788</code></p>
<p>When used together, these two WordPress functions provide an instant snapshot into the basic performance of your web pages. Here is an example of the statistical output generated by these tags working together:</p>
<p><code>33 queries in 0.333 seconds</code></p>
<p>Many of you have probably seen this information while snooping around the far corners of your favorite websites. Lots of people use this code, although not everybody uses it the same way. Here are three great techniques for including this information on your site.</p>
<p><strong>Show it off publicly</strong><br />If you are particularly proud of your server&rsquo;s performance and would like to show off these stats to your visitors, place the following code into the footer or sidebar of your active theme:</p>
<pre><code>&lt;p&gt;&lt;?php echo get_num_queries(); ?&gt; queries in &lt;?php timer_stop(1,3); ?&gt; seconds&lt;/p&gt;</code></pre>
<p><strong>Display it under the hood</strong><br />If you would rather not clutter your design with extraneous information, but still want to keep an eye on these stats, you can &ldquo;comment out&rdquo; the output string so that it only appears as a comment in the source code of your web pages. To do so, place this code in your theme&rsquo;s footer.php file:</p>
<pre><code>&lt;!-- &lt;?php echo get_num_queries(); ?&gt; queries in &lt;?php timer_stop(1,3); ?&gt; seconds --&gt;</code></pre>
<p><strong>Keep it private</strong><br />Last but not least, if you don&rsquo;t like the idea of sharing this information with the entire world, you can limit its display to logged-in administrators only with the following code:</p>
<pre><code>&lt;?php if (current_user_can('level_10')) {

	echo '&lt;!-- ' . get_num_queries() . ' queries in ' . timer_stop(0,3) . ' seconds --&gt;';

} ?&gt;</code></pre>
<p>This tells WordPress to check if the current user is an Administrator (i.e., Level-10 privileges) and if so output the statistical information to the web page. Here we have restricted the display of this information to the source code, but you can change this to display on the page itself by replacing the &ldquo;<code>&lt;!-- </code>&rdquo; and &ldquo;<code> --&gt;</code>&rdquo; with &ldquo;<code>&lt;p&gt;</code>&rdquo; and &ldquo;<code>&lt;/p&gt;</code>&rdquo;, respectively.</p>
<p><strong>Update:</strong> note that there are two ways to display the <code>timer_stop</code> output on the page. The <code>timer_stop()</code> function actually accepts two parameters, <code>$display</code> and <code>$precision</code>. Here are their default values:</p>
<pre><code>&lt;?php timer_stop($display = 0, $precision = 3) ?&gt;</code></pre>
<p>As you might guess, <code>$display</code> is an integer that determines whether or not the function outputs the results to the web page (<code>1</code> for output, <code>0</code> for no output). Thus, you may either use <code>0</code> for the <code>$display</code> parameter and explicitly <code>echo</code> the results; or else you may use <code>1</code> for the <code>$display</code> parameter and omit the explicit <code>echo</code>.</p>
<p>You can see the latter method in the first two examples in this post, and the former in the third. Thanks to <a href="http://www.rarst.net/" title="rarst.net">Rarst</a> for <a href="#comment-1075" title="Jump to original comment">pointing this out</a>&nbsp;:)</p>
<hr />
<p><small>© 2009 <a href="http://digwp.com">Digging into WordPress</a> | <a href="http://digwp.com/2009/08/show-off-your-wordpress-database-statistics/">Permalink</a> | <a href="http://digwp.com/2009/08/show-off-your-wordpress-database-statistics/#comments">26 comments</a> | Add to <a href="http://del.icio.us/post?url=http://digwp.com/2009/08/show-off-your-wordpress-database-statistics/&title=Show Off Your WordPress Database Statistics">del.icio.us</a> | Post tags: <a href="http://digwp.com/tag/database/" rel="tag">database</a>, <a href="http://digwp.com/tag/footer/" rel="tag">footer</a>, <a href="http://digwp.com/tag/statistics/" rel="tag">statistics</a>, <a href="http://digwp.com/tag/tricks/" rel="tag">tricks</a><br/></small></p>]]></content:encoded>
			<wfw:commentRss>http://digwp.com/2009/08/show-off-your-wordpress-database-statistics/feed/</wfw:commentRss>
		<slash:comments>26</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>

