get_results("SELECT YEAR(post_date_gmt) AS year FROM $wpdb->posts WHERE post_date_gmt > 1970 ORDER BY post_date_gmt ASC"); $firstpost_year = $post_datetimes[0]->year; $lastpost_year = $post_datetimes[count($post_datetimes)-1]->year; $copyright = __('Copyright © ', $themeName) . $firstpost_year; if($firstpost_year != $lastpost_year) { $copyright .= '-'. $lastpost_year; } echo $copyright; ?>
Powered by WordPress, Theme by SQL Statements Tutorial.