找到主题文件ripro-v2/inc/template-shop.php
大约在540行左右
找到开端【输出下载地址按钮】
【 获取会员到期时间】结尾
这中间的代码替换为下面的新代码,此代码原创免费分享,操作前请先备份主题,数据库再行操作
/**
* 输出下载地址按钮
* @Author Dadong2g
* @DateTime 2021-04-13T20:10:15+0800
* @param [type] $post_ID [description]
* @return [type] [description]
*/
function the_post_shop_downurl_btns($post_ID = null, $nonce = '') {
if (empty($post_ID)) {
global $post;
$post_ID = $post->ID;
}
$arr = get_post_shop_downurl($post_ID);
foreach ($arr as $key => $item) {
$down_ids = urlencode(base64_encode($post_ID . '-' . $key . '-' . $nonce));
$down_link = get_goto_url('down', $down_ids);
global $current_user;
if ($current_user->ID > 0) {
echo '<div class="btn-group btn-block mt-2" role="group">';
echo '<a target="_blank" href="'%20.%20$down_link%20.%20'" class="btn btn-dark"><i class="fas fa-download"></i> ' . $item['name'] . '</a>';
}else{
$cao_price = get_post_meta(get_the_ID(), 'cao_price', true);
if ($cao_price == 0) {
echo '<div class="btn-group btn-block mt-2" role="group">';
echo '<a class="btn btn-dark login-btn">请先登录</a>';
} else {
echo '<div class="btn-group btn-block mt-2" role="group">';
echo '<a target="_blank" href="'%20.%20$down_link%20.%20'" class="btn btn-dark"><i class="fas fa-download"></i> ' . $item['name'] . '</a>';
}
}
if (!empty($item['pwd'])) {
echo '<button type="button" class="go-copy btn btn-sm btn-dark" data-toggle="tooltip" data-placement="top" title="' . esc_html__('点击复制密码', 'ripro-v2') . '" data-clipboard-text="' . $item['pwd'] . '"><span>' . esc_html__('密码:', 'ripro-v2') . '</span>' . $item['pwd'] . '</button>';
}
echo '</div>';
}
wp_enqueue_script('clipboard');
}
© 版权声明
THE END
暂无评论内容