PHP Paypal Donation Shortcode


SUBMITTED BY: Guest

DATE: Oct. 22, 2013, 1:46 p.m.

FORMAT: PHP

SIZE: 960 Bytes

HITS: 1128

  1. <?php
  2. function donate_shortcode( $atts, $content = null) {
  3. global $post;extract(shortcode_atts(array(
  4. 'account' => 'your-paypal-email-address',
  5. 'for' => $post->post_title,
  6. 'onHover' => '',
  7. ), $atts));
  8. if(empty($content)) $content='Make A Donation';
  9. return '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business='.$account.'&item_name=Donation for '.$for.'" title="'.$onHover.'">'.$content.'</a>';
  10. }
  11. add_shortcode('donate', 'donate_shortcode');
  12. ?>
  13. /*
  14. Instructions:
  15. This code will make it simpler to accept paypal donations.
  16. To use it, simply place the above snippet in your functions.php file and use any of the shortcodes below.
  17. */
  18. [donate]
  19. [donate]Donate Now[/donate]
  20. [donate account="you@yoursite.com" onHover="Thanks" for="Title"]
  21. [donate account="you@yoursite.com" onHover="Thanks" for="Title"]Donate Now[/donate]

comments powered by Disqus