纪念日网页变灰的Joe主题设置方式

1、修改function.php

在function.php文件里新增如下代码,文件路径:usr/themes/Joe

// 全站置灰
$websiteChgGray = new Typecho_Widget_Helper_Form_Element_Select(
    'websiteChgGray',
    array(
        'off' => '关闭(默认)',
        'on' => '开启',
    ),
    'on',
    '是否启用全站置灰',
    '介绍:开启后,网站所有信息全部变成黑白'
);
$websiteChgGray->setAttribute('class', 'joe_content joe_custom'); // 如果无法显示设置,将joe_custom修改为joe_other
$form->addInput($websiteChgGray->multiMode());

2、修改include.php

在include.php文件的底部增加,文件路径:usr/themes/Joe/public

<?php if ($this->options->websiteChgGray === 'on') : ?>
    <style>html { filter: grayscale(1); }</style>
<?php endif; ?>
© 版权声明
THE END
如果喜欢,可以【点赞】【分享】【收藏】
点赞11赞赏 分享
评论 抢沙发
头像
人生坎坎,山山而峦,不过尔尔;心路漫漫,水水而川,如此悠悠
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容