zibll美化交流分享社区-zibll美化交流分享板块-zibll子比主题-zibll子比社区
zibll美化交流分享-zibll子比社区

zibll美化交流分享

帖子 685互动 3.2W+关注 749
来,一起美化一下子比主题吧
zibll美化交流分享-zibll子比社区
子比主题 给搜索框架的右侧新增两个按钮-zibll子比社区
隐藏搜索图标 电脑端评论图片-zibll子比社区 移动端 只能改成这样了 空间不足 评论图片-zibll子比社区

/**
 * 在顶部多功能组件搜索框右侧添加两个按钮:开始探索 + 创作者入驻
 */
add_action('wp_footer', 'zib_custom_search_buttons');
function zib_custom_search_buttons() {
?>
<style>
.header-slider-search .search-input .line-form {
    display: flex;
    align-items: center;
    gap: 10px;
}
.header-slider-search .search-custom-btns {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    align-items: center;
}
.header-slider-search .search-custom-btns .but {
    border-radius: var(--main-radius, 8px);
    white-space: nowrap;
    padding: 4px 16px;
    font-size: 14px;
}
.header-slider-search .line-form {
    border-radius: 0;
}
.header-slider-search .abs-right {
    display: none;
}
.header-slider-search .search-submit-btn {
    cursor: pointer;
}
.header-slider-search .search-submit-btn:hover {
    opacity: 0.8;
}

@media screen and (max-width: 768px) {
    .header-slider-search .search-input .line-form {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .header-slider-search .search-custom-btns {
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
    }
    .header-slider-search .search-custom-btns .but {
        font-size: 12px;
        padding: 3px 12px;
    }
    .header-slider-search .search-input-text {
        width: 100%;
    }
    .header-slider-search .line-form-input {
        width: 100%;
    }
}
</style>
<script>
document.addEventListener('DOMContentLoaded', function() {
    var btns = '<div class="search-custom-btns">' +
        '<a href="/explore" class="but c-yellow">开始探索</a>' +
        '<a href="/creator" class="but c-blue-2">创作者入驻</a>' +
        '<button type="submit" class="but c-green search-submit-btn">搜索</button>' +
    '</div>';
    
    document.querySelectorAll('.header-slider-search .search-input .line-form').forEach(function(form) {
        if (!form.querySelector('.search-custom-btns')) {
            form.insertAdjacentHTML('beforeend', btns);
        }
    
        var searchBtn = form.querySelector('.search-submit-btn');
        if (searchBtn) {
            searchBtn.addEventListener('click', function(e) {
                e.preventDefault();
                var searchForm = form.closest('form');
                if (searchForm) {
                    searchForm.submit();
                }
            });
        }
    });
});
</script>
<?php
}
该帖子内容已隐藏

以下用户组可查看

推广会员推广会员及以上会员

登录后查看我的权限

该帖子部分内容已隐藏
付费阅读
已售 23
100积分
此内容为付费阅读,请付费后查看
该帖子部分内容已隐藏
付费阅读
已售 50
50积分
代码部分
WordPress文章美化段落渐变背景样式教程-zibll子比社区
给你改了个放在func文件里面的直接插入短代码使用,更简洁 效果图 评论图片-zibll子比社区 后台编辑直接替换短代码中间文字即可评论图片-zibll子比社区 func.php代码如下放在最底部即可

// 渐变部分输出样式
function custom_gradient_styles() {
    ?>
    
    /* 渐变段落类名 */
    .grad-x1 { background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%); color: #4a4a4a; border-left:5px solid #6c5ce7; padding:20px; border-radius:12px; margin:20px 0; line-height:1.8; transition:all 0.3s ease; box-shadow:0 5px 15px rgba(0,0,0,0.08);}
    .grad-x1:hover { transform:translateY(-5px); box-shadow:0 10px 25px rgba(0,0,0,0.15);}
    .grad-x2 { background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%); color:#4a4a4a; border-left:5px solid #4a69bd; padding:20px; border-radius:12px; margin:20px 0; line-height:1.8; transition:all 0.3s ease; box-shadow:0 5px 15px rgba(0,0,0,0.08);}
    .grad-x2:hover { transform:translateY(-5px); box-shadow:0 10px 25px rgba(0,0,0,0.15);}
    .grad-x3 { background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%); color:#4a4a4a; border-left:5px solid #e17055; padding:20px; border-radius:12px; margin:20px 0; line-height:1.8; transition:all 0.3s ease; box-shadow:0 5px 15px rgba(0,0,0,0.08);}
    .grad-x3:hover { transform:translateY(-5px); box-shadow:0 10px 25px rgba(0,0,0,0.15);}
    .grad-x4 { background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%); color:#4a4a4a; border-left:5px solid #00b894; padding:20px; border-radius:12px; margin:20px 0; line-height:1.8; transition:all 0.3s ease; box-shadow:0 5px 15px rgba(0,0,0,0.08);}
    .grad-x4:hover { transform:translateY(-5px); box-shadow:0 10px 25px rgba(0,0,0,0.15);}

    /* 提示框类名 */
    .tip-bx { background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%); padding:20px; border-radius:10px; margin:30px 0; border-left:5px solid #e17055; position:relative;}
    .tip-bx::before { content:'提示'; position:absolute; top:-12px; left:20px; background:#e17055; color:#fff; padding:5px 15px; border-radius:20px; font-size:0.9rem; font-weight:bold;}
    
    <?php
}
add_action('wp_head', 'custom_gradient_styles');

// ----------------------------
// 渐变段落短代码 s1-s4
// ----------------------------
function gradient_shortcode_factory($atts, $content, $class_name) {
    return ''.do_shortcode($content).'';
}
add_shortcode('s1', function($atts, $content){ return gradient_shortcode_factory($atts, $content, 'grad-x1'); });
add_shortcode('s2', function($atts, $content){ return gradient_shortcode_factory($atts, $content, 'grad-x2'); });
add_shortcode('s3', function($atts, $content){ return gradient_shortcode_factory($atts, $content, 'grad-x3'); });
add_shortcode('s4', function($atts, $content){ return gradient_shortcode_factory($atts, $content, 'grad-x4'); });

// ----------------------------
// 提示框短代码 b1
// ----------------------------
function tip_shortcode($atts, $content = null) {
    return ''.do_shortcode($content).'';
}
add_shortcode('b1', 'tip_shortcode');
?>
评论图片-zibll子比社区
在网站侧边栏中添加一个好看的滚动公告
该帖子部分内容已隐藏
付费阅读
已售 45
200积分
此内容为付费阅读,请付费后查看
打字html效果 有需要也可以用《发帖备份》-zibll子比社区
评分
59分享
炫酷打字效果的IP签名档-zibll子比社区
该帖子部分内容已隐藏
付费阅读
已售 7
50
此内容为付费阅读,请付费后查看