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="'.$account.'&item_name=Donation for '.$for.'" title="'.$onHover.'">'.$content.'</a>';
add_shortcode('donate', 'donate_shortcode');


[donate]Donate Now[/donate]
[donate account="" onHover="Thanks" for="Title"]
[donate account="" onHover="Thanks" for="Title"]Donate Now[/donate]

Leave a comment