Paypal donation shortcode

Adding the first block of code to the functions.php of your wordpress theme will allow you to use the following shortcode for donation links within your blog.

function donate_shortcode( $atts, $content = null) {
global $post;extract(shortcode_atts(array(
'account' => 'your-paypal-email-address',
'for' => $post->post_title,
'onHover' => '',
), $atts));</p>
<p>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');
[donate]Donate Now[/donate]
[donate account="you@yoursite.com" onHover="Thanks" for="Title"]
[donate account="you@yoursite.com" onHover="Thanks" for="Title"]Donate Now[/donate]

Comments  Leave a Reply

  1. Tweets that mention Wordpress Paypal donation shortcode – wpsnipp.com Wordpress code snippets for your blog -- Topsy.com February 4, 2011 at 5:43 pm

    […] This post was mentioned on Twitter by HN Firehose and wp_freak, WPSNIPP. WPSNIPP said: #wordpress Paypal donation shortcode http://bit.ly/e7dnmj #blog please RT 🙂 […]

  2. WordPress Paypal donation shortcode – wpsnipp.com WordPress code snippets for your blog…

    Add Paypal donation button to your posts using shortcode…

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!