From 81511a16b0de216c723a45ec2d2f7498b06150e3 Mon Sep 17 00:00:00 2001 From: lvshujun Date: Mon, 11 Mar 2024 13:06:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E7=94=A8wp=5Fadd=5Finline=5Fstyle?= =?UTF-8?q?=E6=8C=82=E8=BD=BD=E8=A1=8C=E5=86=85=E5=92=8C=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- header.php | 4 ---- inc/init.php | 16 +++++++++++++++- templates/css-grey.php | 12 ------------ 3 files changed, 15 insertions(+), 17 deletions(-) delete mode 100644 templates/css-grey.php diff --git a/header.php b/header.php index 6f5abb19..99763a4a 100755 --- a/header.php +++ b/header.php @@ -10,15 +10,11 @@ - - - " . pk_get_option('css_code_header', '') . ""; ?> - diff --git a/inc/init.php b/inc/init.php index 0b3541e5..0dd95c61 100755 --- a/inc/init.php +++ b/inc/init.php @@ -171,7 +171,6 @@ function pk_init_register_assets() wp_enqueue_style('puock-strawberry-icon-admin', pk_get_static_url() . '/assets/libs/strawberry-icon.css', [], PUOCK_CUR_VER_STR); wp_enqueue_script('puock-admin', pk_get_static_url() . '/assets/dist/js/admin.min.js', [], PUOCK_CUR_VER_STR, true); } else { -// wp_deregister_script('jquery'); wp_register_script('jquery', pk_get_static_url() . '/assets/libs/jquery.min.js', [], PUOCK_CUR_VER_STR); wp_enqueue_script('jquery'); wp_enqueue_style('puock-libs', pk_get_static_url() . '/assets/dist/style/libs.min.css', [], PUOCK_CUR_VER_STR); @@ -193,6 +192,21 @@ function pk_init_register_assets() wp_enqueue_script('puock-gt4', pk_get_static_url() . '/assets/libs/gt4.js', [], PUOCK_CUR_VER_STR, true); } wp_enqueue_script('puock', pk_get_static_url() . '/assets/dist/js/puock.min.js', array('puock-libs'), PUOCK_CUR_VER_STR, true); + + //加载全站黑白样式 + if(pk_is_checked('grey')){ + wp_add_inline_style( 'puock', 'html { + filter: grayscale(100%); + -webkit-filter: grayscale(100%); + -moz-filter: grayscale(100%); + -o-filter: grayscale(100%); + }'); + } + + //加载自定义样式 + if (!empty(pk_get_option('css_code_header', ''))){ + wp_add_inline_style( 'puock', pk_get_option('css_code_header', '')); + } } } diff --git a/templates/css-grey.php b/templates/css-grey.php deleted file mode 100644 index 92b1e5aa..00000000 --- a/templates/css-grey.php +++ /dev/null @@ -1,12 +0,0 @@ - - -