欢迎您光临10元资源网,本站秉承服务宗旨 履行“站长”责任,销售只是起点 服务永无止境!

Ripro美化-头像悬浮窗添加一键复制推广链接

Ripro美化-头像悬浮窗添加一键复制推广链接

教程开始

第一步打开ripro/子主题的/parts/navbar-hover.php搜索header-bottom,然后在上面添加以下代码【如果子主题没有这个文件的去ripro复制一份】

<!–用户下拉框新增推广链接start–>
<div class=”tg-xinghai” id=”xhrefurl” data-clipboard-text=”<?php echo cao_get_referral_link($current_user->ID)?>” style=”cursor: pointer;”>
<span id=”xhrefurl”><?php echo cao_get_referral_link($current_user->ID)?></span><em>复制推广获取佣金</em>
</div>
<!–用户下拉框新增推广链接end–>

第二步添加样式代码添加到diy.css

/*用户下拉框新增推广链接*/
.header-box .tg-xinghai {
height: 40px;
line-height: 40px;
position: relative;
overflow: hidden;
margin: 10px 0;
border-radius: 5px;
padding-left: 10px;
color: #fff;
background: linear-gradient(125deg,#f90202 0%, #2f49fd 100%);
}

第三步,添加js代码到你任何注册到主题的文件中,

// 推广链接复制功能
function copyArticle(con) {
const range = document.createRange();
range.selectNode(document.getElementById(con));
const selection = window.getSelection();
if(selection.rangeCount > 0) selection.removeAllRanges();
selection.addRange(range);
document.execCommand(‘copy’);
}
$(‘#xhrefurl’).click(function () {
copyArticle(‘xhrefurl’)
});

也可以把第二段代码添加到footer.php</html>后面

<script type=’text/javascript’>
// 推广链接复制功能
function copyArticle(con) {
const range = document.createRange();
range.selectNode(document.getElementById(con));
const selection = window.getSelection();
if(selection.rangeCount > 0) selection.removeAllRanges();
selection.addRange(range);
document.execCommand(‘copy’);
}
$(‘#xhrefurl’).click(function () {
copyArticle(‘xhrefurl’)
});
</script>


大资源网 » Ripro美化-头像悬浮窗添加一键复制推广链接

发表评论

售后服务:

  • 售后服务范围 1、商业模板使用范围内问题免费咨询
    2、源码安装、模板安装(一般 ¥200-1000)服务答疑仅限SVIP用户
    3、单价超过1000元的模板免费一次安装,需提供服务器信息。
    付费增值服务 1、提供dedecms模板、WordPress主题、discuz模板优化等服务请详询在线客服
    2、承接 WordPress、DedeCMS、Discuz 等系统建站、仿站、开发、定制等服务
    3、服务器环境配置(一般 ¥50-300)
    4、网站中毒处理(需额外付费,500元/次/质保三个月)
    售后服务时间 周一至周日(法定节假日除外) 9:00-23:00
    免责声明 本站所提供的模板(主题/插件)等资源仅供学习交流,若使用商业用途,请购买正版授权,否则产生的一切后果将由下载用户自行承担,有部分资源为网上收集或仿制而来,若模板侵犯了您的合法权益,请来信通知我们(Email: 263795763@qq.com),我们会及时删除,给您带来的不便,我们深表歉意!

Hi, 如果你对这款模板有疑问,可以跟我联系哦!

联系作者
';