快轉到主要內容

footer的自动版权信息部分

124 字1 分鐘00
作者Y Cheung

PHP代码:

 1<?php global $wpdb; 
 2$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")); 
 3
 4if ($post_datetimes) { 
 5    $firstpost_year = $post_datetimes->firstyear; 
 6    $lastpost_year = $post_datetimes->lastyear; 
 7    $copyright = $firstpost_year; 
 8    if($firstpost_year != $lastpost_year) { 
 9        $copyright .= '-'. $lastpost_year; 
10        } 
11    $copyright .= ' '; 
12    echo $copyright; 
13    } ?>
14    < ?php bloginfo('name'); ?><?php echo get_option('home'); ?> / Theme designed by 你的大名

CSS代码:

1 #copyright { float:left; display:inline; margin:55px 0 0 -10px; color:#777; } #copyright li { float:left; display:inline; font-size:11px; margin:0 10px 0 0; padding:0 0 0 13px; background:url(img/footer_line.gif) no-repeat left center; } #copyright li a, #copyright li a:visited { text-decoration:underline; }
分享

相關文章

添加纪念日小工具

作者 Y Cheung598 字2 分鐘00

由https://coels.net/开发的纪念日小工具 。可自由DIY,添加方式也很简单,放入后台widget就行了。 记住:JavaScript中双引号是不能换行的!!!!! …

添加留言回复通知插件

作者 Y Cheung245 字1 分鐘00

因为每次都要手动写@user 有时名称中含有空格就更不好办了的缘故,我换下了mail to commenter插件,改用水煮鱼的Comment Reply …

Blog出现一系列错误

作者 Y Cheung555 字2 分鐘00

昨天装好的新主题,今天又陆陆续续发现一大堆问题,o(╯□╰)o »FEED出错 ×IE8下atom就可以,RSS就出错。 ×chrome由于它自己申明不支持RSS订阅,忽略它,但是 …

换WordPress主题

作者 Y Cheung229 字1 分鐘00

今天换了WP主题了。。。。折腾了一下午,就是在那鼓捣某几条代码,怎么都弄不对,哎~貌似到现在还有点点问题,看来等等 @showfom 睡醒了再让他帮我看看了。 停了 …

Blog添加Sociable插件

作者 Y Cheung99 字1 分鐘00

这个不多说,很方便的一个插件,支持世界上主流的社会化分享网站,支持自定义图标,更多选项安装后在设置中调整。 Automatically add links on your …

↑