来自B2主题的VIP会员开通页面美化,由狐狸适配至子比主题,这里在原有样式上进行了小修改,有兴趣的可以学习一下!去掉了下面的常见问题板块,只留下开通模块,添加了用户评价模块,后续有空会再次更新优化。
演示效果
部署教程
直接上传到子比主题根目录解压即可。
路径: /www/wwwroot/huliku.com/wp-content/themes/zibll 直接解压。
然后来到WordPress后台 -> 页面 -> 新建页面,输入好标题,选择好VIP模版发布即可。
相关图片均已打包在压缩包内直接解压即可。
函数代码
将代码加入 func.php 或 functions.php 文件中(两个文件性质一样,只是 func.php 子比更新不会被覆盖掉,也就不需要再次修改),理应在 <?php 后面加入。
文件路径:/www/wwwroot/huliku.com/wp-content/themes/zibll/functions.php
/*月卡、季卡、年卡、永久会员的数量查询 huliku.com*/
function get_expiring_vip_user_count($type) {
$current_date = date("Y-m-d");
$expiring_count = 0;
$meta_query = array('relation' => 'AND');
switch ($type) {
case 'monthly':
$one_month_later = strtotime("+1 month");
$meta_query[] = array(
'key' => 'vip_exp_date',
'value' => array($current_date, date("Y-m-d", $one_month_later)),
'compare' => 'BETWEEN',
'type' => 'DATE',
);
break;
case 'quarterly':
$two_months_later = strtotime("+2 months");
$three_months_later = strtotime("+3 months");
$meta_query[] = array(
'key' => 'vip_exp_date',
'value' => array(date("Y-m-d", $two_months_later), date("Y-m-d", $three_months_later)),
'compare' => 'BETWEEN',
'type' => 'DATE',
);
break;
case 'yearly':
$eleven_months_later = strtotime("+11 months");
$meta_query[] = array(
'key' => 'vip_exp_date',
'value' => date("Y-m-d", $eleven_months_later),
'compare' => '>',
'type' => 'DATE',
);
break;
case 'permanent':
$meta_query[] = array(
'key' => 'vip_exp_date',
'value' => 'Permanent',
'compare' => '=',
);
break;
}
$args = array(
'meta_query' => $meta_query,
'count_total' => true,
);
$user_query = new WP_User_Query($args);
$expiring_count = $user_query->get_total();
return $expiring_count;
}