演示效果

代码部署开始
1、添加到子主题b2child/style.css以下代码
/*自定义支付美化开始*/
.custom-pay-box p,.custom-pay-box .cpay-form-title,.custom-pay-box .cpay-tab > div span{
font-size:16px;
}
.cpay-radio-box label + label, .cpay-checkbox-box label + label,.cpay-radio-box label, .cpay-checkbox-box label{
display:block!important;
}
.cpay-radio-box label input, .cpay-checkbox-box label input{
margin-right:0px!important;
}
.cpay-radio-box label div{
text-align:center;
font-size:16px;
overflow: hidden; /* 确保超出容器的文字被截断 */
white-space: nowrap; /* 防止文字换行 */
}
.cpay-radio-box-list, .cpay-checkbox-box-list{
width:100%;
}
.cpay_fl_img{
height:80px;
width:80px;
margin: 0 auto;
padding: 5px;
}
.cpay_fl_img img{
width:100%;
height:100%;
}
@media (min-width: 768px) {
.cpay_fl{
padding:10px;
width:33.333333%;
}
}
@media (max-width: 768px) {
.cpay_fl{
padding:10px;
width:50%;
}
}
.cpay-submit button{
font-size:16px;
}
/*自定义支付美化结束*/
2、复制附件中的b2child目录下的文件到子主题对应目录下
3、子主题b2child/functions.php加入代码
require_once get_stylesheet_directory() . '/Modules/Common/Shortcode.php';
//$order 是此自定义支付的订单信息,包含 order_id、user_id、post_id 等信息,post_id 为 此自定义支付的id,user_id为支付用户的id。其他订单字段的信息您可以前往数据库查看。
function b2_zanzu_resout($data){
$user_id=$data['user_id'];
if (!$user_id) {
return;
}
$vip_title='赞助会员';
$current_time = current_time("Y-m-d H:i:s");
global $wpdb;
$table_name = $wpdb->prefix . 'b2_verify';
$sql = $wpdb->prepare("SELECT * FROM {$table_name} WHERE user_id = %d", $user_id);
$id_verify = $wpdb->get_results($sql);
$verify_data = array(
'user_id' => $user_id,
'title' => $vip_title,
'status' => 2,
'date'=> $current_time,
'money'=> 1,
'identification'=>1,
'mp'=>1,
'verified'=>1,
);
$verify_data2 = array(
'title' => $vip_title,
'status' => 2,
'date'=> $current_time,
'money'=> 1,
'identification'=>1,
'mp'=>1,
'verified'=>1,
);
update_user_meta($user_id,'b2_title',$vip_title);
do_action('b2_submit_verify_after',$data);
do_action('b2_user_rebuild_title', $user_id);
if (!$id_verify){
$wpdb->insert($table_name, $verify_data);
}else{
$wpdb->update($table_name,$verify_data2,array( 'user_id' => $user_id ));
}
}
创建自定义支付页面
支付金额填写
10
20
30
50
100
500
开启金额关联
金额关联字段zib
回调填写b2_zanzu_resout的话,赞助后会获得认证称号
自定义表单key填zib,单选,内容如下
a=一个鸡腿
b=一杯咖啡
c=一个汉堡
d=一份肯德基套餐
e=一份全家桶
f=一份大额红包

对于大神的文章我真是百看不厌!