页脚的版权信息和日期是很常见的 也是任何网站必有的模块
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)