RiPro主题美化首页模块-添加简介联系提示模块代码教程 WordPress 第1张

添加模块代码:

查找到
'disabled' => array(
在下方添加
'IntroCallTips' => '简介联系提示模块',

模块设置代码:

查找

——首页模块布局

在下面的));结尾处,添加下面代码。

// 网站简介联系提示模块设置
CSF::createSection($prefix, array(
    'parent' => 'home_fields',
    'title'  => '网站简介联系提示模块'.$lixui_mod,
    'icon'   => 'fa fa-quote-right',
    'description' => ''.$lixui_tip,
    'fields' => array(
        //简介联系提示模块
        array(
            'id'         => 'is_wzjjlxts_lixui',
            'type'       => 'switcher',
            'help'       => '有问题访问官网 WWW.LIITK.COM 或联系 QQ1576384173',
            'title'      => '网站简介联系提示模块',
            'label'      => '首页网站简介联系提示模块,仅在电脑端显示',
            'default'    => true,
        ),
        //网站简介信息设置
        array(
            'id'         => 'site_wzjjlxts_lixui',
            'type'       => 'fieldset',
            'title'      => '网站简介信息设置',
            'fields'     => array(
                array(
                    'id'         => 'wzbt1_text',
                    'type'       => 'text',
                    'title'      => '网站标题',
                    'default'    => '利熙网',
                ),
				array(
                    'id'         => 'wzbt1_link',
                    'type'       => 'text',
                    'title'      => '标题链接',
                    'default'    => 'https://www.liitk.com/',
                ),
				array(
                    'id'         => 'wzbt2_text',
                    'type'       => 'text',
                    'title'      => '网站副标题',
                    'default'    => 'WWW.LIITK.COM',
                ),
				array(
                    'id'         => 'jjxx1_text',
                    'type'       => 'text',
                    'title'      => '简介信息①',
                    'default'    => '简介内容①',
                ),
				array(
                    'id'         => 'jjxx2_text',
                    'type'       => 'text',
                    'title'      => '简介信息②',
                    'default'    => '简介内容②',
                ),
           ),
            'dependency' => array('is_wzjjlxts_lixui', '==', 'true'),
        ),
        //图文联系信息设置
        array(
            'id'         => 'site_wzjjlxts_lixui',
            'type'       => 'fieldset',
            'title'      => '图文联系信息设置',
            'fields'     => array(
				array(
                    'id'         => 'jjlx1_text',
                    'type'       => 'text',
                    'title'      => '标题信息①',
                    'default'    => '国内优质的的资源平台',
                ),
				array(
                    'id'         => 'jjlx2_text',
                    'type'       => 'text',
                    'title'      => '标题信息②',
                    'default'    => '@利熙网 ~ 联系我 ~',
                ),
                array(
                    'id'         => 'jjlx_link',
                    'type'       => 'text',
                    'title'      => '标题链接',
                    'default'    => 'https://wpa.qq.com/msgrd?v=3&uin=1576384173',
                ),
				array(
                    'id'         => 'jjlx_img',
                    'type'       => 'upload',
                    'title'      => '图片地址(224x213)',
                    'default'    => '/wp-content/themes/lixui-chlid/assets/images/lixui-bottom-share.png',
                ),
           ),
            'dependency' => array('is_wzjjlxts_lixui', '==', 'true'),
        ),
        
    ),
));

模块文件代码:

IntroCallTips.php,自行创建然后上传至ripro/parts/home-mode目录下。

<?php /*网站简介联系提示模块*/
$site_wzjjlxts_lixui = _cao('site_wzjjlxts_lixui');
if (is_array($site_wzjjlxts_lixui)  && _cao('is_wzjjlxts_lixui') ) : ?>
<div class="footer-fav">
	  <div class="container">
	    <div class="fl site-info">
	      <h2> <a href="<?php echo $site_wzjjlxts_lixui['wzbt1_link']; ?>" target="_blank"><?php echo $site_wzjjlxts_lixui['wzbt1_text']; ?></a> <?php echo $site_wzjjlxts_lixui['wzbt2_text']; ?></h2>
	      <div class="site-p">
	          <p><?php echo $site_wzjjlxts_lixui['jjxx1_text']; ?></p>
	          <p><?php echo $site_wzjjlxts_lixui['jjxx2_text']; ?></p>
	        </a>
	      </div>
	    </div>
	    <div class="fr site-fav">
	      <a href="javascript:AddFavorite()" class="btn btn-fav btn-orange">按Ctrl+D收藏本站</a></div>
	    <div class="site-girl">
	      <a href="<?php echo $site_wzjjlxts_lixui['jjlx_link']; ?>" target="_blank">
	        <div class="girl fl"> <i class="thumb " style="background-image:url(<?php echo $site_wzjjlxts_lixui['jjlx_img']; ?>);"></i> </div>
	        <div class="girl-info hide_md">
	          <h4> <?php echo $site_wzjjlxts_lixui['jjlx1_text']; ?> </h4>
	          <h4> <?php echo $site_wzjjlxts_lixui['jjlx2_text']; ?> </h4>
	        </div>
	      </a>
	    </div>
	  </div>
	</div>
	<script>
    function AddFavorite(title, url) {
     try {
       window.external.addFavorite(url, title);
     }
    catch (e) {
       try {
        window.sidebar.addPanel(title, url, "");
      }
       catch (e) {
         alert("抱歉,您所使用的浏览器无法完成此操作。\n\n加入收藏失败,请手动按Ctrl+D进行添加收藏。");
       }
     }
    }
    </script>
<?php endif; ?>

CSS:

/* 简介联系提示模块开始 */
.footer-fav {
	position: relative;
	/*z-index: 20;*/
	overflow: hidden;
	width: 100%;
	background: #879DFF;
}
@media (min-width:768px) {
	.footer-fav {
		overflow: visible;
		width: auto;
		background: linear-gradient(-125deg,#0066FF 0%, #33CCCC 100%);
	}
}
.footer-fav .container {
	overflow: visible;
	padding-top: 36px;
	padding-bottom: 36px
}
.footer-fav .site-info {
	width: 60%
}
@media (min-width:768px) {
	.footer-fav .site-info {
		display: inline-block;
		width: auto
	}
}
.footer-fav .site-info h2 {
	margin-bottom: 10px;
	text-transform: uppercase;
	font-size: 20px;
	line-height: 1.4
}
@media (min-width:768px) {
	.footer-fav .site-info h2 {
		font-size: 26px;
	    color: #666666;
	}
}
.footer-fav .site-info h2 a {
	color: #141414;
}
.footer-fav .site-info .site-p {
	margin-bottom: 10px
}
.footer-fav .site-info .site-p p:first-child:after {
	content: ','
}
@media (min-width:768px) {
	.footer-fav .site-info .site-p {
		margin-bottom: 0
	}
	.footer-fav .site-info .site-p p:first-child:after {
		content: ''
	}
}
.footer-fav .site-info p {
	display: inline;
	margin-bottom: 10px;
	color: #FFF;
	font-size: 9pt;
	line-height: 1.8
}
@media (min-width:768px) {
	.footer-fav .site-info p {
		display: block;
		margin-bottom: 0;
		font-size: 14px
	}
}
.footer-fav .site-fav {
	padding-top: 5px
}
@media (min-width:768px) {
	.footer-fav .site-fav {
		float: right;
		display: block;
		padding-top: 24px
	}
}
.footer-fav .site-fav .btn-orange {
	padding: 0 1.2em;
	font-size: 14px;
	line-height: 2.5
}
@media (min-width:768px) {
	.footer-fav .site-fav .btn-orange {
		padding: 0 2em;
		color: #fff;
		font-size: 1pc;
		line-height: 3.5
	}
}
.footer-fav .site-girl {
	position: absolute;
	bottom: 0;
	left: 50%
}
.footer-fav .site-girl .girl {
	position: absolute;
	bottom: 0;
	left: 0;
	width: 180px;
	transition: all .3s
}
@media (min-width:768px) {
	.footer-fav .site-girl .girl {
		left: -50px
	}
}
.footer-fav .site-girl .girl:after {
	position: absolute;
	top: 40%;
	left: 100%;
	display: block;
	visibility: hidden;
	color: #a7a7a7;
	content: 'Hi~';
	font-size: 20px;
	opacity: 0;
	transition: all .2s;
	transition: all .3s
}
.footer-fav .site-girl .thumb {
	display: block;
	padding-top: 116.667%
}
.footer-fav .site-girl .girl-info {
	margin-bottom: 55px;
	margin-left: 150px
}
.footer-fav .site-girl h4 {
	color: #FFF;
	font-weight: 400;
	font-size: 14px;
	line-height: 1.8
}
.footer-fav .site-girl a {
	color: #797979
}
.footer-fav .site-girl a:hover {
	color: #ff5c00
}
@media (min-width:768px) {
	.footer-fav:hover .site-girl .girl {
		left: -5pc
	}
	.footer-fav:hover .site-girl .girl:after {
		visibility: visible;
		opacity: 1;
		transition: all .2s
	}
}
@media (max-width:767px) {
	.footer-fav .btn-group>.btn:last-child {
		border-radius: 3px
	}
}
@media (max-width:767px) {
	.home .footer-fav {
		display: none
	}
}
.btn-orange {
	display: block;
	outline: 0;
	border: none;
	border-radius: 3px;
	background: #746afc;
	color: #fff;
	text-align: center;
	line-height: 2.4;
	cursor: pointer
}
/* 简介联系提示模块结束 */

 

发表评论

后才能评论