如何在Cpanel中添加带有图像的Whastap共享按钮



我在php文件中添加了以下代码:

<script type='text/javascript'>if(typeof wabtn4fg===&quot;undefined&quot;){wabtn4fg=1;h=document.head||document.getElementsByTagName(&quot;head&quot;)[0],s=document.createElement(&quot;script&quot;);s.type=&quot;text/javascript&quot;;s.src=&quot;https://cdn.jsdelivr.net/whatsapp-sharing/1.3.4/whatsapp-button.js&quot;;h.appendChild(s);}</script>
<a class='wa_btn wa_btn_l' expr:data-href='data:post.url' expr:data-text='data:post.title' href='whatsapp://send' style='display:none'>Share this Article!</a>

但没有表现出来。完整代码:

<div class="article-header">
<img src="images/news/<?php echo $news['photo']; ?>" class="article-photo" alt="" />
<div class="article-meta">
<div class="meta-date">
<span class="date"><?php echo substr($news['tanggal'],8,2) ?></span>
<span class="month"><?php echo substr($news['tanggal'],5,2)?>, <?php echo substr($news                      ['tanggal'],0,4) ?> </span>
<span class="author">by <a href="#"><?php echo $news['penulis']; ?></a></span>
</div>
<script type='text/javascript'>if(typeof wabtn4fg===&quot;undefined&quot;){wabtn4fg=1;h=document.head||document.getElementsByTagName(&quot;head&quot;)[0],s=document.createElement(&quot;script&quot;);s.type=&quot;text/javascript&quot;;s.src=&quot;https://cdn.jsdelivr.net/whatsapp-sharing/1.3.4/whatsapp-button.js&quot;;h.appendChild(s);}</script>
<a class='wa_btn wa_btn_l' expr:data-href='data:post.url' expr:data-text='data:post.title' href='whatsapp://send' style='display:none'>Share this Article!</a>
<div class="meta-tools">
<span><i class="fa fa-text-height"></i>Ukuran Font <span class="f-size"><a href="#font-size-down">-</a><span class="f-size-number">16</span><a href="#font-size-up">+</a></span></span>
</div>
</div>
</div>

<script>标记中,将所有&quot;替换为'

此外,该脚本仅适用于移动设备。它在加载时检查用户代理,并且只有当用户设备是android或ios时才会显示。

最新更新