A fresh mix of code snippets and tutorials

Deluxe Copyright Dates in WordPress

There are (at least) three ways to display copyright information (date and name) on your WordPress-powered web pages.

Simple static copyright & date

The first way is to just use text, like so:

All contents copyright 2013 WP-mix.com

Simple dynamic copyright & date

The second way is to use the date() function to generate the current year:

© 2013 – <?php echo date('Y'); ?> WP-mix.com

Deluxe dynamic copyright & date range

The third and most awesome way of displaying a date range & copyright information is to add this snippet to your theme’s functions.php file:

function deluxe_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 WHERE post_status = 'publish'");
	$output = '';
	if($copyright_dates) {
		$copyright = "© " . $copyright_dates[0]->firstdate;
		if($copyright_dates[0]->firstdate != $copyright_dates[0]->lastdate) {
			$copyright .= '-' . $copyright_dates[0]->lastdate;
		$output = $copyright;
	return $output;

Then to display the deluxe copyright information, add the following tag anywhere in your theme (e.g., footer.php):

<?php echo if (function_exists('deluxe_copyright')) deluxe_copyright(); ?>

Customize as needed!

Learn more

Digging Into WordPressWordPress Themes In DepthWizard’s SQL Recipes for WordPress