7

WordPress/cms/Zibll子比主题美化 更改首页顶部全宽度样式

作者 : 佩斯音频工作室 本文共4167个字,预计阅读时间需要11分钟 发布时间: 2023-04-14 共727人阅读

WordPress/cms/Zibll子比主题美化 更改首页顶部全宽度样式插图

PHP代码

使用教程

PHP代码
在主题目录下“func.php”下面添加下面代码,这是我修改后的“图文封面卡片”小工具

// 图文封面卡片(星语修改版)
Zib_CFSwidget::create('wiiuii_widget_ui_graphic_cover', array(
    'title'       => '图文封面卡片(星语修改版)',
    'zib_title'   => true,
    'zib_affix'   => true,
    'zib_show'    => true,
    'description' => '由星语一人独立修改并美化(WWW.YILUXB.CN)',
    'fields'      => array(
        array(
            'id'       => 'pc_row',
            'title'    => '排列布局',
            'subtitle' => 'PC端单行排列数量',
            'default'  => 4,
            'options'  => array(
                1  => '1个',
                2  => '2个',
                3  => '3个',
                4  => '4个',
                6  => '6个',
                12 => '12个',
            ),
            'type'     => 'button_set',
            'class'    => 'button-mini',
        ),
        array(
            'id'       => 'm_row',
            'title'    => ' ',
            'subtitle' => '移动端单行排列数量',
            'decs'     => '请根据此模块放置位置的宽度合理调整单行数量,避免显示不佳',
            'class'    => 'compact button-mini',
            'default'  => 2,
            'options'  => array(
                1  => '1个',
                2  => '2个',
                3  => '3个',
                4  => '4个',
                6  => '6个',
                12 => '12个',
            ),
            'type'     => 'button_set',
        ),
        array(
            'id'      => 'mask_opacity',
            'title'   => '遮罩透明度',
            'help'    => '图片上显示的黑色遮罩层的透明度',
            'default' => 10,
            'max'     => 90,
            'min'     => 0,
            'step'    => 1,
            'unit'    => '%',
            'type'    => 'slider',
        ),
        array(
            'id'      => 'top_scale',
            'title'   => '顶部位置',
            'subtitle' => '与幻灯片的位置',
            'default' => 50,
            'max'     => 100,
            'min'     => 0,
            'step'    => 5,
            'unit'    => 'px',
            'type'    => 'spinner',
        ),
        array(
            'id'      => 'height_scale',
            'title'   => '封面长宽比例',
            'default' => 30,
            'max'     => 300,
            'min'     => 5,
            'step'    => 5,
            'unit'    => '%',
            'type'    => 'spinner',
        ),
        array(
            'id'       => 'font_size_pc',
            'title'    => '文字样式',
            'subtitle' => 'PC端字体大小',
            'default'  => 18,
            'max'      => 80,
            'min'      => 10,
            'step'     => 2,
            'unit'     => 'px',
            'type'     => 'spinner',
        ),
        array(
            'id'       => 'font_size_m',
            'title'    => ' ',
            'class'    => 'compact',
            'subtitle' => '移动端字体大小',
            'default'  => 14,
            'max'      => 80,
            'min'      => 10,
            'step'     => 2,
            'unit'     => 'px',
            'type'     => 'spinner',
        ),
        array(
            'id'    => 'font_bold',
            'class' => 'compact',
            'type'  => 'switcher',
            'label' => '粗体显示',
        ),
        array(
            'class'    => 'compact',
            'id'       => 'font_color',
            'title'    => ' ',
            'type'     => 'color',
            'subtitle' => '文字颜色',
        ),

        array(
            'id'           => 'covers',
            'title'        => '添加封面',
            'type'         => 'group',
            'button_title' => '添加内容',
            'default'      => array(),
            'fields'       => array(
                array(
                    'title'   => __('背景图', 'zib_language'),
                    'id'      => 'image',
                    'default' => '',
                    'preview' => true,
                    'library' => 'image',
                    'type'    => 'upload',
                ),
                array(
                    'title'      => '文字',
                    'id'         => 'title',
                    'default'    => '',
                    'desc'       => '支持HTML代码',
                    'attributes' => array(
                        'rows' => 1,
                    ),
                    'type'       => 'textarea',
                ),
                array(
                    'id'           => 'link',
                    'type'         => 'link',
                    'title'        => '跳转链接',
                    'default'      => array(),
                    'add_title'    => '添加链接',
                    'edit_title'   => '编辑链接',
                    'remove_title' => '删除链接',
                ),
            ),
        ),
    ),
));

function wiiuii_widget_ui_graphic_cover($args, $instance)
{
    $show_class = Zib_CFSwidget::show_class($instance);
    if (empty($instance['covers'][0]['image']) || !$show_class) {
        return;
    }

    //准备栏目
    $pc_row = (int) $instance['pc_row'];
    $m_row  = (int) $instance['m_row'];

    $row_class = 'col-sm-' . (int) (12 / $pc_row);
    $row_class .= $m_row > 1 ? ' col-xs-' . (int) (12 / $m_row) : '';

    $is_row = count($instance['covers']) > 1;
    $html   = '';
    $style  = '';
    $style .= $instance['font_size_pc'] && 14 != $instance['font_size_pc'] ? '--font-size:' . ((int) $instance['font_size_pc']) . 'px;' : '';
    $style .= $instance['font_size_m'] && 14 != $instance['font_size_m'] ? '--font-size-sm:' . ((int) $instance['font_size_m']) . 'px;' : '';
    $style .= $instance['font_bold'] ? '--font-weight:bold;--font-weight-sm:bold;' : '';
    $style .= $instance['font_color'] ? '--color:' . $instance['font_color'] . ';--color-sm:' . $instance['font_color'] . ';' : '';
    $style = $style ? ' style="' . $style . '"' : '';

    foreach ($instance['covers'] as $cover) {
        $more = $cover['title'] ? '<div class="abs-center text-center graphic-text this-font">' . $cover['title'] . '</div>' : '';
        $card = array(
            'type'         => '',
            'class'        => 'wiiuii-graphic-cover-special-item mb10',
            'img'          => $cover['image'],
            'alt'          => strip_tags($cover['title']),
            'link'         => $cover['link'],
            'lazy'         => zib_is_lazy('lazy_cover'),
            'more'         => $more,
            'height_scale' => $instance['height_scale'],
            'mask_opacity' => $instance['mask_opacity'],
        );
        $html .= $is_row ? '<div class="' . $row_class . '">' : '';
        $html .= zib_graphic_card($card);
        $html .= $is_row ? '</div>' : '';
    }

    echo '<div class="wiiuii-graphic-cover-special" style="margin-top:-' . ($instance["top_scale"] ? $instance["top_scale"] : 50) . 'px">';
    Zib_CFSwidget::echo_before($instance, 'widget-graphic-cover ' . ($is_row ? 'mb10' : 'mb20'));
    echo '<div' . $style . '>';
    echo $is_row ? '<div class="row gutters-5">' : '';
    echo $html;
    echo $is_row ? '</div>' : '';
    echo '</div></div>';

    Zib_CFSwidget::echo_after($instance);
}

CSS样式

自己在后台“主题设置”中的“自定义CSS样式”(别告诉我你不知道在哪哈)

SVIP免费 永久SVIP免费

已有0人支付

OK,添加代码就这些,下面是一些相关设置!!!

关于一些设置,我不想说,自己看图吧:

1、添加小工具,添加我“修改的版本”哦!

 

WordPress/cms/Zibll子比主题美化 更改首页顶部全宽度样式插图2

2、子比主题“全屏幻灯片”设置 WordPress/cms/Zibll子比主题美化 更改首页顶部全宽度样式插图4

 

支持技术 服务范围 1: 本网站名称:佩斯资源网
2: 本站永久网址:https://www.pstyw.com
3: 远程在线解决声卡各种问题排查/处理,各种声卡关联机架跳线,安装插件/机架/驱动,以及各种问题(20元起加一项加10元)QQ1943590279进行技术支持。
4: 在线一对一插件/机架/声卡跳线教学(50元起)。
5: 声卡效果调试,一对一根据人声声线精调,精调效果永久免费维护。不满意全额退款
注:免费维护,不再动效果。重装系统还原,修改效果参数,添加插件收费。一对一精调效果: 点击试听。
联系方式: 微信:CXY5520YP QQ:1943590279 QQ群:683643827 微信群:加微信,发会员帐号,佩斯邀请入群。
本站所有资源仅供学习与参考,请勿用于商业用途,如有侵犯版权,请及时联系1943590279@qq.com,我们将尽快删除处理。

佩斯资源网 » WordPress/cms/Zibll子比主题美化 更改首页顶部全宽度样式


富强民主文明和谐自由平等公正 法制丨爱国敬业诚信友善

Copyright © 2021 佩斯音频网 All Rights Reserved
E-mail:1943590279@qq.com
安全运行
本站总访问量 本站访客数

在线人数:1人