and like us on FB

Unless you’re living under a rock (or you live in Tasmania), you’re probably already well aware that PayPal provides donate buttons for your website. This post details how to display a text link or button that will send visitors to your PayPal donate page. Personally, I’m not a fan of using donate buttons for any purpose other than sending people to a genuine charity; there are far more effective and less intrusive ways of supporting your website than asking your visitors for cash. Member areas, digest subscriptions and other types of protected member-only content are a far more effective (and ethical) means of establishing a recurring income.

The following shortcode may be used on a WordPress website to render a text donation link or image that will redirect to PayPal.

The Result

The shortcode of [donate image="1"] returns an image as follows. Click on it to see the result (just don’t donate anything!).

A text link, using [donate image="0"] returns the following:

Make a donation with PayPal

WordPress Shortcode

Copy and paste the WordPress function into your theme's functions.php file or, if you sensibly have one installed, your custom functions plugin.

If you require shortcode to work in a sidebar widget, you'll have to enable the functionality with a filter. If you're using our custom functions plugin, you'll have that feature enabled by default.

Shortcode Attributes

text

Text that will link to PayPal. Defaults to “Make a donation with PayPal”.

image & image_url

To render an image link use image="1", and to return a text link use image="0". If an image is returned, ensure you provide a full URL to the image location.

account

Email attached to your PayPal account.

itemname& itemnumber

The itemname & itemnumber are ‘essentially’ a category and sub-category used for referencing the source of nature of the donation. If not defined, itemname will display your ‘blog name’ and itemnumber will render “Donation for [author_name] via [Blog Post Name]” (see images below for examples).

amount

The default amount to be paid. Will prompt for a value if not defined. Not required.

Considerations

PayPal image links are far more popular than the text link I’ve provided above. If you’re only going to use a single instance of a PayPal image, you may want to consider simply using the online tool provided on the PayPal website. If, however, you want to retain control over multiple buttons in different locations, or you want to style them individually (say, for different authors), then shortcode is almost certainly the better option.

Shortt URL for this post: http://shor.tt/2jHC