Donations via PayPal?

So I found this a little useful and I’ll be adding it to my site very soon. I got to thinking about the time I put in to blog posts, screencasts, etc. and thought wouldn’t it be nice to have people that enjoy what I bring give me a little something in return? Sure everyone loves little things, even coffee! 🙂

I found this little bit of code to take donations via PayPal. Hope you enjoy!

Place this in your functions.php file.

[php]function donate_shortcode( $atts, $content = null ) {
global $post;
extract(shortcode_atts(array(
‘account’ => ‘your paypal email address’,
‘for’ => $post->post_title,
‘onHover’ => ”,
), $atts));
if(empty($content)) $content=’Make A Donation’;
return ‘<a href=”https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=’.$account.’&item_name=Donation for ‘.$for.’” title=”‘.$onHover.’”>’.$content.'</a>’;
}
add_shortcode(‘donate’, ‘donate_shortcode’);
[/php]

Then all you need to do is add any of the following to your post/s

[html][donate]
[donate]Donate Now[/donate]
[donate account=”[email protected]” onHover=”Thanks!” for”Title”]
[donate account=”[email protected]” onHover=”Thanks!” for”Title”]Donate Now![/donate]
[/html]

AJ Morris Avatar