Wordpress动态版权日期

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Wordpress动态版权日期相关的知识,希望对你有一定的参考价值。

in the theme's footer.php insert
  1. function comicpress_copyright() {
  2. global $wpdb;
  3. $copyright_dates = $wpdb->get_results("
  4. SELECT
  5. YEAR(min(post_date_gmt)) AS firstdate,
  6. YEAR(max(post_date_gmt)) AS lastdate
  7. FROM
  8. $wpdb->posts
  9. WHERE
  10. post_status = 'publish'
  11. ");
  12. $output = '';
  13. if($copyright_dates) {
  14. $copyright = "© " . $copyright_dates[0]->firstdate;
  15. if($copyright_dates[0]->firstdate != $copyright_dates[0]->lastdate) {
  16. $copyright .= '-' . $copyright_dates[0]->lastdate;
  17. }
  18. $output = $copyright;
  19. }
  20. return $output;
  21. }

以上是关于Wordpress动态版权日期的主要内容,如果未能解决你的问题,请参考以下文章