当前位置: 首页 » 网站建设 » wordpress教程 » 正文

wordpress免插件纯代码实现支付宝微信的打赏功能

发布时间:2025-01-16 以下文章来源于网友投稿,内容仅供参考!

打赏功能从去年开始火了起来,微博微信陆续的添加了打赏功能。遍地的wordpress的个人站长紧跟风头,纷纷添加打赏功能。虽然真正收到钱的寥寥无几。但是依然无法阻止此功能在wordpress程序中的漫延。

各种搜索引擎中可以检索到很多关于wordpress打赏的插件,当然这不是我们讲的重点,我们要达到的是摒弃插件,用纯代码来实现打赏功能

第一步,将如下代码添加至主题的function.php ,记得在 “?>”前添加即可。

area data-settings="dblclick" readonly >function orwei_ds_alipay_wechat(){ //注意更换为你的支付宝或微信收款二维码,二维码获取请自行百度 echo '<section ><div ><div ><a>赏<span ><img alt="" src="输入图像地址" alt="wordpress免插件实现支付宝微信的打赏支付功能"><b>支付宝 扫一扫</b></span></a></div></div></section>'; }area>1function orwei_ds_alipay_wechat(){ //注意更换为你的支付宝或微信收款二维码,二维码获取请自行百度 echo '<section ><div ><div ><a>赏<span ><img alt="" src="输入图像地址" alt="wordpress免插件实现支付宝微信的打赏支付功能"><b>支付宝 扫一扫</b></span></a></div></div></section>'; }

第二步,添加如下样式至主题的style.css ,开始部分对移动端做了隐藏消除,考虑到ios不支持hover伪类(还可以自由发挥添加链接点击方式)

area data-settings="dblclick" readonly >@media (max-width: 800px) { .to-tip {display:none !important} } .to-tip { background:#fff; text-align:center } .to-tip .inner { display:inline-block; margin-bottom:40px; } .to-tip .top-tip-shap { border-radius:100% } .to-tip a { display:block; width:60px; height:60px; border:1px solid #eee; border-radius:100%; line-height:58px; color:#999; font-size:24px; background:#fff; position:relative } .to-tip a:hover .code { display:block } .to-tip div { color:#666; margin-top:4px } .to-tip .code { position:absolute; padding:20px; border:1px solid #e6e6e6; background-color:#fff; line-height:14px; width:160px; height:170px; top:-200px; left:50%; -webkit-transform:translate3d(-50%, 0, 0); transform:translate3d(-50%, 0, 0); display:none } .to-tip .code:before,.to-tip .code:after { position:absolute; content:""; border:10px solid transparent } .to-tip .code:before { border-top-color:#e6e6e6; left:50%; margin-left:-10px; bottom:-20px } .to-tip .code:after { border-top-color:#fff; left:50%; margin-left:-10px; bottom:-19px } .to-tip .code img { width:120px; height:120px } .to-tip .code b { color:#333; font-size:12px; font-weight:normal }area>1@media (max-width: 800px) { .to-tip {display:none !important} } .to-tip { background:#fff; text-align:center } .to-tip .inner { display:inline-block; margin-bottom:40px; } .to-tip .top-tip-shap { border-radius:100% } .to-tip a { display:block; width:60px; height:60px; border:1px solid #eee; border-radius:100%; line-height:58px; color:#999; font-size:24px; background:#fff; position:relative } .to-tip a:hover .code { display:block } .to-tip div { color:#666; margin-top:4px } .to-tip .code { position:absolute; padding:20px; border:1px solid #e6e6e6; background-color:#fff; line-height:14px; width:160px; height:170px; top:-200px; left:50%; -webkit-transform:translate3d(-50%, 0, 0); transform:translate3d(-50%, 0, 0); display:none } .to-tip .code:before,.to-tip .code:after { position:absolute; content:""; border:10px solid transparent } .to-tip .code:before { border-top-color:#e6e6e6; left:50%; margin-left:-10px; bottom:-20px } .to-tip .code:after { border-top-color:#fff; left:50%; margin-left:-10px; bottom:-19px } .to-tip .code img { width:120px; height:120px } .to-tip .code b { color:#333; font-size:12px; font-weight:normal }

第三步,调用函数,一般添加至single.php,具体位置请自行参考。

area data-settings="dblclick" readonly ><?php echo orwei_ds_alipay_wechat();?>area>1<?php echo orwei_ds_alipay_wechat();?>
  • • 开启wds是什么意思?无线路由器wds是怎么开启?

    开启wds是什么意思?WDS是英文Wireless Distribution System的简称,中文名称是:无线分布式系统。WDS功能就是一种帮助无线基站与

  • • 系统boot是什么意思?电脑出现boot manager怎么办?

    系统boot是什么意思1、开机后我们连续按启动热键,进入bios界面,我们就可以看到boot了。2、boot有启动的意思,在电脑中就是指电

  • • win10系统msconfig无法正常启动怎么办?win10系统msconfig怎么设置最

    msconfig打不开解决办法:1.先打开电脑开始菜单,在操作窗口输入regedit,打开注册表编辑器。然后将HKEY_LOCAL_MACHINE\SOFTWARE

  • • 金士顿u盘怎么写保护?金士顿U盘恢复出厂设置怎么操作?

    金士顿u盘怎么写保护?方法一:如果你的U盘如我简介中说的那样,有一个自带的物理写保护的小 开关 ,就观察一下是不是已经将开关

  • • 苹果AirPods Pro 2发布 搭载H2芯片降噪能力翻倍

    9月8日凌晨,苹果正式发布第二代主动降噪耳机AirPods Pro 2,搭载H2芯片,降噪能力翻倍,而且续航也飚至30小时。得益于全新的H2

  • biubiu加速器
    九游优盟游戏推广平台
    九游推广联盟
    digdig游戏入口
    4999小游戏大全
    九游游戏网
    站长素材
    植物大战僵尸杂交免费版
    站长之家
    测速网在线测网速
    354211邮编查询,354211邮政编码查询
    354209邮编查询,354209邮政编码查询
    353132邮编查询,353132邮政编码查询
    354215邮编查询,354215邮政编码查询
    353121邮编查询,353121邮政编码查询
    354213邮编查询,354213邮政编码查询
    353125邮编查询,353125邮政编码查询
    354201邮编查询,354201邮政编码查询
    353101邮编查询,353101邮政编码查询
    354200邮编查询,354200邮政编码查询