1function comicpress_copyright() // returns: (c) My blog Name 2014 - 2021
2{
3 global $wpdb;
4 $copyright_dates = $wpdb->get_results("
5 SELECT
6 YEAR(min(post_date_gmt)) AS firstdate,
7 YEAR(max(post_date_gmt)) AS lastdate
8 FROM
9 $wpdb->posts
10 WHERE
11 post_status = 'publish'
12 ");
13 $output = '';
14 if ($copyright_dates) {
15 $copyright = "© " . get_bloginfo('name') . ' ' . $copyright_dates[0]->firstdate;
16 if ($copyright_dates[0]->firstdate != $copyright_dates[0]->lastdate) {
17 $copyright .= '-' . $copyright_dates[0]->lastdate;
18 }
19 $output = $copyright;
20 }
21 return $output;
22}