頁腳的版權信息和日期是很常見的 也是任何網站必有的模塊
wordpress網站推廣中對此有特殊的函數處理 若是想加入動態的又比較合規範的頁腳版權日期php
1 簡單方法:推薦
在你的footer文件中加入以下代碼wordpress
© 2011 – <?php echo date('Y'); ?> YourSite.com
2 合乎規範的高質量的動態添加方式 (強烈推薦): 函數
- function comicpress_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[]->firstdate;
- if($copyright_dates[]->firstdate != $copyright_dates[]->lastdate) {
- $copyright .= '-' . $copyright_dates[]->lastdate;
- }
- $output = $copyright;
- }
- return $output;
- }
在footer.php中添加以下代碼post
<?php echo comicpress_copyright(); ?> (fblww-0313)