6

修复博客主题PHP8兼容和优化深色模式

 2 years ago
source link: https://qq52o.me/2798.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

修复博客主题PHP8兼容和优化深色模式

网站记录 / 2021年11月22日 / 6 条评论
qq52o-logo.png!blog

前段时间花了 700 块,买了腾讯云三年的 4H8G5M 的服务器

迁移博客等系统到了这台新的机器上,重新编译了一下运行环境,升级到了 PHP8,不过主题有一些不兼容的地方,导致了一些 Warning 的输出

  • commentform.php

$post_id 未定义,原来直接判断是否全等于 null

if ( empty($post_id) ) {
    $post_id = get_the_ID();
}
  • inc/theme-options.php

$option['before'] 未定义

<span class="description"><?php echo $option['before'] ?? ''; ?></span>
  • inc/metabox.php

$value['desc'] 未定义

echo ' <span class="desc">' . ($value['desc'] ?? '') . '</span></td></tr>';

分页处的说明在深色模式下成了白色,无法看清楚第几页;赞赏按钮的背景太亮

@media (prefers-color-scheme:dark) {
    .page-indicator small {
        background: #333;
    }

    .tip-popover {
        background: var(--bg-color);
        color: #fff;
    }
}

这篇文章是由新写的 Markdown 解析插件解析为 Html 的。

沈唁志 任何个人或团体,未经允许禁止转载本文:《修复博客主题 PHP8 兼容和优化深色模式》,谢谢合作!

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK