每个网站底部都会出现一个版权日期,比如web建站建站的版权日期是Copyright©2019-2023
,那么如何实现每年自动更新呢?
找到当前主题函数模板functions.php中新增以下代码:
function ipkd_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[0]->firstdate; if( $copyright_dates[0]->firstdate != $copyright_dates[0]->lastdate ) { $copyright .= '-' . $copyright_dates[0]->lastdate; } $output = $copyright; } return $output; }
在页面中调用一以下代码:
<?php echo ipkd_copyright(); ?>
wordpress建站如何快速提交和优化您的网站(IndexNow插件)?
标签: wordpress技巧, wordpress版权日期
上面是“wordpress底部的版权日期如何实现每年自动更新”的全面内容,想了解更多关于 wordpress 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_4388.html
workflows工作流
红伞伞蓝杆杆云南蘑菇群ComfyUI工作流
一只可爱的草莓味冰淇淋卷筒
一只黑色的小猫在童话森林里嗅着一朵发光的外星花
一只被水晶包围的小动物ComfyUI工作流
一只张大嘴巴露出锋利的牙齿正在咆哮的雪豹
1个很漂亮的单身小女孩ComfyUI工作流
一只黑色章鱼ComfyUI工作流
汗血宝马ComfyUI工作流
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!