How to Display a Dynamics Date Copyright


Sponsored Links




Have you ever seen, some time website has Copyright on the footer? Example on WordPress Tricks Copyright © 2010 – WordPress Tricks & Tips is proudly powered by WordPress, On this tutorial I will show you How to Create and Display a Dynamics Date Copyright in WordPress. All need to do only writen a functions in your theme functions.php and use Add Filter or manually insert code on your footer.

How to Display a Dynamics Date Copyright

How to Display a Dynamics Date Copyright

Write down Dynamics Date Copyright function below

<?php // display range of dates for copyright @ WPTricks.net
function do_copyright() {
	global $wpdb;
	$copyright_dates = $wpdb->get_results("
		SELECT
			YEAR(min(post_date_gmt)) AS firstdate,
			YEAR(max(post_date_gmt)) AS lastdate
		FROM
			$wpdb->posts
	");
	if($copyright_dates) {
		$copyright = "Copyright &copy; " . $copyright_dates[0]->firstdate;
		if($copyright_dates[0]->firstdate != $copyright_dates[0]->lastdate) {
			$copyright .= '-' . $copyright_dates[0]->lastdate;
		}
		echo $copyright;
	}
}
add_filter('wp_footer', 'do_copyright');
?>

On the code above the functions will be added automatically on your wp_footer(), but if you want manually added, just remark add_filter function and add manually do_copyright() in your footer.php. Thanks for DigWP to share this code and we hope tutorial to display a dynamics date range copyright work on you…

Subscribe to Full RSS Feed

RSS FeedIf you thing this article useful, please consider subscribing to our RSS Feed or e-mail updates and stay updated with us. You can also follow @WPTricksNet on twitter for latest updates.

About WP Tricks

We are WordPress Family, we collected and writed useful tips and tricks for you WordPress. We share it for you...

Related Tips and Trick from Local Data and on The Net


2 Responses to How to Display a Dynamics Date Copyright

  1. redlex says:

    This collection shows just how versatile wordpress is thanks to the imagination of many designers

  2. Pingback: The Creative Solution to Insert Google Analytics on WordPress | WordPress News Wire

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>