纪念日网页变灰的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; ?>
© 版权声明
底线,心之尺,言之界
心有所喜,可点赞、可分享、可收藏
点赞11赞赏 分享
寄言于此 抢沙发
头像
愿您每一次发声,皆为生活添色,予人共鸣、沉思与欢喜
提交
头像

昵称

取消
昵称表情代码图片快捷回复

    暂无评论内容