星比天高 发表于 2024-3-24 07:47:32

【zibll】子比小优化-未登录模糊文章图片

效果文章图片文章灯箱https://file.77il.cn/wp-content/uploads/2023/05/d2b5ca33bd203754.jpg提醒其实防不住采集和F12,因为采集不采集CSS,F12会懂一点的也防不住。代码【子比专属】其实思路都一样,只需要你自己F12定位自己想要模糊的DIV就是
//未登录文章详情页内图片模糊
function unlogin_css(){
echo '<style>
.article-content img {
-webkit-filter: blur(10px)!important;
    -moz-filter: blur(10px)!important;
    -ms-filter: blur(10px)!important;
    filter: blur(6px)!important;}
.swiper-close img {
-webkit-filter: blur(10px)!important;
    -moz-filter: blur(10px)!important;
    -ms-filter: blur(10px)!important;
    filter: blur(6px)!important;}
    </style>';
}
if( !is_user_logged_in()) {add_action( 'wp_head', 'unlogin_css' );};//未登录全站图片模糊
function all_css(){
echo '<style>
img {
-webkit-filter: blur(10px)!important;
    -moz-filter: blur(10px)!important;
    -ms-filter: blur(10px)!important;
    filter: blur(6px)!important;}
    </style>';
}
if( !is_user_logged_in()) {add_action( 'wp_head', 'all_css' );};主题根目录functions.php中
页: [1]
查看完整版本: 【zibll】子比小优化-未登录模糊文章图片