Posted By

planetabhi on 06/01/12


Tagged

wordpress donate PayPal


Versions (?)

Add PayPal Donate button to your Wordpress Website


 / Published in: PHP
 

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');

Report this snippet  

You need to login to post a comment.