正在使用riplus的朋友们都知道,这次的riplus的VIP介绍模块都采用的是静态,但是很多朋友可能会感觉到比较难受,今天给大家送上一段代码让他成为动态!
将下面这个代码全部复制替换掉主题目录下/template-parts/home/vipinfo.php 这个文件。
注意:代码283行2020-03-25为网站开始运行时间
[wm_reply]
<?php
if (is_close_site_shop()) {
return false;
}
$vip_opt = _get_site_vip_options();
//此代码由65源码二次更改,转载请注意添加链接并注释
//油条友情提示:修改此处文字即可完成自定义diy自己的内容
//图标地址:http://cdn.materialdesignicons.com/3.6.95/ 选择喜欢的图标,单机复制,回来粘贴即可
$coldata=[
[
'icon'=>'mdi-access-point', //图标
'title'=>$wpdb->get_var($wpdb->prepare("SELECT COUNT(post_id) FROM $wpdb->postmeta WHERE meta_key=%s AND meta_value=%s", 'cao_status',1)).'+资源,无限量下载', //标题
'desc'=>'真正的海量,无套路,诚意满满,会员资源免费下载', //描述
],
[
'icon'=>'mdi-cloud-download',
'title'=>'5m/s速度,百度云极速下载',
'desc'=>'本地无需备份,即需即下,无需等待',
],
[
'icon'=>'mdi-gitlab',
'title'=>'999+原创精品,专享下载',
'desc'=>'严格审核原创版权作品,VIP任性下载!',
],
[
'icon'=>'mdi-diamond-stone',
'title'=>'VIP标示,彰显尊贵身份',
'desc'=>'点亮尊贵身份标示,散发与众不同气质',
],
];
//会员价格介绍模块
$_caovip_data = [
[
'title'=>$vip_opt['month_vip']['name'].'会员',
'r_title'=>'一个月时长',
'price'=>$vip_opt['month_vip']['price'],
'color'=>'success',
'desc'=>'<li>免费资源无限下载</li>
<li>VIP资源全部免费</li>
<li>每天10次VIP资源下载</li>
<li>全站无限制收藏次数</li>
<li>月卡VIP会员专属资源</li>
<li><s>月卡VI会员P专属资源</s></li>
<li><s>月卡VIP会员专属资源</s></li>
<li><s>5×8小时在线人工客服</s></li>
<li><s>优先体验新功能</s></li>',
],
[
'title'=>$vip_opt['year_vip']['name'].'会员',
'r_title'=>'12个月时长',
'price'=>$vip_opt['year_vip']['price'],
'color'=>'danger',
'desc'=>'<li>免费资源无限下载</li>
<li>年VIP资源全部免费</li>
<li>每天20次VIP资源下载</li>
<li>全站无限制收藏次数</li>
<li>月卡VIP会员专属资源</li>
<li>年卡VIP会员专属资源</li>
<li><s>永久VIP会员专属资源</s></li>
<li><s>5×8小时在线人工客服</s></li>
<li><s>优先体验新功能</s></li>',
],
[
'title'=>$vip_opt['permanent_vip']['name'].'会员',
'r_title'=>'终身永久有效',
'price'=>$vip_opt['permanent_vip']['price'],
'color'=>'warning',
'desc'=>'<li>免费资源无限下载</li>
<li>永久VIP资源全部免费</li>
<li>每天66次VIP资源下载</li>
<li>全站无限制收藏次数</li>
<li>永久VIP会员专属资源</li>
<li><s>年卡VI会员P专属资源</s></li>
<li><s>永久VIP会员专属资源</s></li>
<li><s>5×8小时在线人工客服</s></li>
<li><s>优先体验新功能</s></li>',
],
];
// 帮助配置 在这里修改 图标参考同上面图标参考地址一样
$carddata = [
[
'icon'=>'mdi-help-network',
'title'=>'开通会员后是否可以无限下载',
'desc'=>'本站所有资源,针对不同等级VIP会员可直接下载,特殊资源商品会注明是否免费,指会员所享有根据选择购买的会员选项所享有的特殊服务,具体以本站公布的服务内容为准',
],
[
'icon'=>'mdi-hand',
'title'=>'VIP会员支持续费吗,到期后权限如何重新开通?',
'desc'=>'在遵守VIP会员协议前提下,VIP会员支持升级续费,月卡VIP可以升级年卡VIP,年卡VIP可以升级永久VIP,永久VIP是最高权限,本站所有资源,针对不同等级VIP会员可直接下载,特殊资源商品会注明是否免费,VIP会员在会员有效期内可以任意下载所有免费和VIP资源。',
],
[
'icon'=>'mdi-google-photos',
'title'=>'购买VIP后是否可以退款?',
'desc'=>'VIP会员属于虚拟服务,付款后不能够申请退款。请您在确认开通前认真选购,如付款前有任何疑问,联系站长咨询确认。',
],
];
// 帮助配置 在这里修改 图标参考同上面图标参考地址一样
// 这里为静态数组展示 为什么不用动态呐 因为很多人的站没有那么多真实数据
$coldata2 = [
[
'color'=>'text-warning',
'icon'=>'mdi-account-group',
'title'=>$wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->users").'+',
'desc'=>'会员总数(位)',
],
];
$is_pt = (is_page_template('pages/vipinfo.php')) ? 'mt-0' : 'mt-5' ;
?>
<div class="vipinfo-part <?php echo $is_pt;?>">
<section class="vipinfo-page lazyload py-5 mb-0" data-bg="<?php echo get_template_directory_uri();?>/assets/img/vipinfo-banner.png">
<div class="container text-center">
<h3 class="h3 text-white">加入本站VIP会员订阅计划,海量资源免费下载查看</h3>
<p class="text-white">目前为止共有 <span class="badge badge-pill badge-light"><?php $users = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->users"); echo $users; ?>+</span> 位优秀的VIP会员加入!</p>
<a target="_blank" href="<?php echo esc_url(home_url('/user?action=vip'));?>" class="btn btn-outline-warning"><i class="mdi mdi-diamond-stone"></i> 立即加入VIP会员</a>
</div>
</section>
<section class="slice pt-0 mt-0 bg-white">
<div class="container">
<div class="mb-5 text-center">
<h3 class="pt-5">VIP会员尊享专属特权</h3>
</div>
<div class="row">
<?php foreach ($coldata as $k => $v) { ?>
<div class="col-lg-6">
<div class="card hover-shadow-lg hover-scale-110">
<div class="card-body py-4">
<div class="d-flex align-items-start">
<div class="icon text-primary rounded-circle"><i class="mdi <?php echo $v['icon'];?>"></i></div>
<div class="icon-text pl-4">
<h5 class="ma-0 "><?php echo $v['title'];?></h5>
<p class="mb-0"><?php echo $v['desc'];?></p>
</div>
</div>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
</section>
<section class="vipinfo-page slice pt-5 mb-5">
<span class="tongue tongue-up tongue-section-primary">
<i class="mdi mdi-chevron-up"></i>
</span>
<div class="container position-relative" style="z-index: 3;max-width: 1080px;">
<div class="row row-grid justify-content-center" style=" margin-bottom: 5rem; ">
<div class="col-lg-6 text-center">
<h6 class="text-sm text-uppercase ls-2 text-white">Pricing</h6>
<h3 class="h3 text-white">关于VIP会员介绍</h3>
</div>
</div>
<div class="pricing card-group flex-column flex-md-row">
<?php foreach ($_caovip_data as $key => $item) {
$cssVal = ($key==1) ? 'card card-pricing rounded text-center scale-110 shadow-lg popular' : 'card card-pricing text-center' ;
?>
<div class="<?php echo $cssVal;?>">
<div class="card-header py-5 border-0 delimiter-bottom">
<span class="d-block h5 mb-4"><i class="mdi mdi-diamond-stone"></i> <?php echo $item['title'];?></span>
<div class="h1 text-center mb-0 text-<?php echo $item['color'];?>">¥<span class="price"><?php echo $item['price'];?></span></div>
<span class="h6 text-muted"><?php echo $item['r_title'];?></span>
</div>
<div class="card-body">
<ul class="list-unstyled mb-4 descinfo">
<?php echo $item['desc'];?>
</ul>
<a href="<?php echo esc_url(home_url('/user?action=vip'));?>" class="btn btn-<?php echo $item['color'];?> btn-shadow mb-3">立即升级</a>
</div>
</div>
<?php } ?>
</div>
</div>
<div class="shape-container" data-shape-position="bottom" style="height:auto;">
<svg preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1437.24 372.58" class="ie-shape-clouds">
<path class="fill-section-primary" d="M1.35,97.76.5-189l16,8.88s28.43-111.93,145.68-53.3c0,0,42.13-28.11,63.71,9.81,0,0,30.73-57.54,90.88-11.11,0,0,136-132.07,196.8,86.3,0,0,86.3-171.3,234.72,5.23,0,0,39.23-102.65,143.19-22.23,0,0,5.88-113.11,149.07-61.46,0,0,68.65-100,189-11.11,0,0,126.84-28.11,151.69,87,0,0,34.65-34.65,56.23-18.31l.33,267.1Z" transform="translate(-0.5 400)"></path>
<path class="fill-section-primary opacity-5" d="M.56-113.82,1.35,97.76H1437.74l-.55-207.55s-62.35-102.82-192-23.19c0,0-50.05-64.84-110.35-5.69,0,0-22.75-37.54-52.33-13.65,0,0-18.2-75.08-87.59-30.71,0,0-29.58-18.2-36.4,8,0,0-101.25-122.86-167.23,18.2,0,0-78.49-60.29-137.65,12.51,0,0-35.27-26.16-52.33-1.14,0,0-2.28-27.3-36.4-11.38,0,0-31.85-52.33-91-21.61,0,0-48.92-64.84-111.48-6.83,0,0-62.88-21.69-72.81,29.58,0,0-44.91-23.4-43.23,19.34,0,0-39.82-51.19-81.91,4.55,0,0-54.6-44.37-94.42,9.1C70-122.74,17.56-154.95.56-113.82Z" transform="translate(-0.5 274.83)"></path>
</svg>
</div>
</section>
<section class="slice bg-white mt-1 pb-5">
<div class="container">
<div class="mb-5 text-center">
<h3 class="h3 pt-5">VIP会员常见问题说明</h3>
<div class="fluid-paragraph mt-3">
<p class="text-muted">开通会员常见问题说明,如又不懂可以联系本站客服咨询</p>
</div>
</div>
<div class="row justify-content-center">
<div class="col-lg-8">
<div id="accordion_1" data-accordion="1">
<?php foreach ($carddata as $k => $v) { ?>
<div class="card mb-3">
<div class="card-header py-4 collapsed" id="heading_1_<?php echo $k;?>" data-toggle="collapse" role="button" data-target="#collapse_1_<?php echo $k;?>" aria-expanded="false" aria-controls="collapse_1_<?php echo $k;?>">
<h5 class="font-weight-normal mb-0"><i class="mdi <?php echo $v['icon'];?>"></i> <?php echo $v['title'];?></h5>
</div>
<div id="collapse_1_<?php echo $k;?>" class="collapse" aria-labelledby="heading_1_<?php echo $k;?>" data-parent="#accordion_1">
<div class="card-body">
<p><?php echo $v['desc'];?></p>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
</section>
<section class="slice py-5">
<div class="container-lg">
<div class="row align-items-md-center">
<?php foreach ($coldata2 as $k => $v) { ?>
<div class="col-lg-3 col-6 mb-5 mb-lg-0">
<div class="text-center mb-5 mb-lg-0">
<div class="icon icon-lg <?php echo $v['color'];?>">
<i class="mdi <?php echo $v['icon'];?>"></i>
</div>
<span class="d-block mt-0 h3 <?php echo $v['color'];?>"><?php echo $v['title'];?></span>
<span class="d-block mt-2 h6"><?php echo $v['desc'];?></span>
</div>
</div>
<?php } ?>
<!--总更新-->
<div class="col-lg-3 col-6 mb-5 mb-lg-0">
<div class="text-center mb-5 mb-lg-0">
<div class="icon icon-lg text-info">
<i class="mdi mdi-timelapse"></i>
</div>
<span class="d-block mt-0 h3 text-info"><?php $count_posts = wp_count_posts(); echo $published_posts = $count_posts->publish;?>+</span>
<span class="d-block mt-2 h6">资源总数(个)</span>
</div>
</div>
<!--每日更新-->
<div class="col-lg-3 col-6 mb-5 mb-lg-0">
<div class="text-center mb-5 mb-lg-0">
<div class="icon icon-lg text-info">
<i class="mdi mdi-timelapse"></i>
</div>
<span class="d-block mt-0 h3 text-info"><?php echo WeeklyUpdate();?>+</span>
<span class="d-block mt-2 h6">今日发布(个)</span>
</div>
</div>
<!--稳定运行天数新-->
<div class="col-lg-3 col-6 mb-5 mb-lg-0">
<div class="text-center mb-5 mb-lg-0">
<div class="icon icon-lg text-success">
<i class="mdi mdi-monitor-multiple"></i>
</div>
<span class="d-block mt-0 h3 text-success"><?php echo floor((time()-strtotime("2020-03-25"))/86400); ?>+</span>
<span class="d-block mt-2 h6">稳定运行(天)</span>
</div>
</div>
</div>
</div>
</section>
</div>
[/wm_reply]
在主题目录里面的functions.php最后添加下面代码
[wm_reply]
// 每日更新的文章数量
function WeeklyUpdate() {
$today = getdate();
$query = new WP_Query( 'year=' . $today["year"] . '&monthnum=' . $today["mon"] . '&day=' . $today["mday"]);
$postsNumber = $query->found_posts;
echo $postsNumber;
}
[/wm_reply]
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
评论(1)
看看