Aktuelles “Copyright” Datum im Footer
Peruns Weblog erinnert daran, das Datum im Footer zu aktualisieren und zeigt auch einen php-oneliner der das Jahr aktuell halten soll.
Folgendes Snippet legt noch einen drauf und gibt den Zeitraum vom ersten bis zum letzten Posting aus, welches Du in deinem Blog geschrieben hast: Copyright © 2008-2010
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <?php global $wpdb; $post_datetimes = $wpdb->get_row($wpdb->prepare("SELECT YEAR(min(post_date_gmt)) AS firstyear, YEAR(max(post_date_gmt)) AS lastyear FROM $wpdb->posts WHERE post_date_gmt > 1970")); if ($post_datetimes) { $firstpost = $post_datetimes->firstyear; $lastpost = $post_datetimes->lastyear; $copyright = 'Copyright © ' . $firstpost; if($firstpost != $lastpost) { $copyright .= '-'. $lastpost; } echo $copyright; } ?> |




Hi Mario,
:-) netter Tweak.
Aufgrund des Artikels von Perun hatte ich gestern etwas mit meinem Footer rumgekaspert und genau eine solche Funktion als Wunsch bestimmt.
Coole Sache.
Danke für den Kniff
;-)
Gerne doch, freut mich wenns jemand benutzen kann : )