Tutorials

How to Add WordPress Paypal Donation Button Shortcode

Pinterest LinkedIn Tumblr

If you are using the WordPress Paypal donation shortcode to accept donations from your website’s visitors, you can use this code snippet to create a shortcode, and thus make donating easier. First, paste the following into your functions.php file:

function wb_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', 'wb_donate_shortcode');

Then, you can easily use the [donate] shortcode, such as:

[donate]My Text Here[/donate]

Or you can use WordPress Online Fundraising Plugin which have complete solution to receive all kind of donation for charity. Checkout plugin here

 

Write A Comment

Pin It