添加贝宝捐赠按钮到您的Wordpress网站

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了添加贝宝捐赠按钮到您的Wordpress网站相关的知识,希望对你有一定的参考价值。

Add this snippet to the functions.php to add 'Donate' Button on your Wordpress Website.
  1. // paypal donate button
  2. function cwc_donate_shortcode( $atts ) {
  3. extract(shortcode_atts(array(
  4. 'text' => 'Make a donation',
  5. 'account' => 'REPLACE ME',
  6. 'for' => '',
  7. ), $atts));
  8.  
  9. global $post;
  10.  
  11. if (!$for) $for = str_replace(" ","+",$post->post_title);
  12.  
  13. return '<a class="donateLink" href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business='.$account.'&item_name=Donation+for+'.$for.'">'.$text.'</a>';
  14.  
  15. }
  16. add_shortcode('donate', 'cwc_donate_shortcode');

以上是关于添加贝宝捐赠按钮到您的Wordpress网站的主要内容,如果未能解决你的问题,请参考以下文章