Create a PayPal Donation Shortcode – WordPress

You are here: Home » Blog » CMS » WordPress » Create a PayPal Donation Shortcode – WordPress

Create a PayPal Donation Shortcode – WordPress

Create a PayPal Donation Shortcode – WordPress: If you are using the PayPal Donate function 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 code in your functions.php file:

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');

Then, you can easily use the [donate] shortcode in your posts and pages, like so:

[donate]Please support this website and donate.[/donate]

By adding the first code snippet to your functions.php file you have created a [donate] shortcode that can be called from anywhere in your website.


Related Posts:

How do I create money online using WordPress?

How to Update: Automatically create media_buttons for shortcode selection

Should I Choose a Hosted or Non-hosted Blogging Platform?

WordPress, SEO, and Social Media Marketing

What is a Shortcode in WordPress?

How do I start a WordPress blog? (hosting wordpress)

Formatting Text in WordPress Posts (Tiny MCE Advanced for WordPress)

Using the Current Year in Your Posts – WordPress

Change the Author Permalink Structure – WordPress

Redirect New Registered Users to a Specific Page – WordPress

Show Popular Posts Without Plugins

FAQ Hacked WordPress Website

The background-color CSS property

Introduction to JavaScript

How to Define a percent surcharge by delivery country with WooCommerce

How to make a Go-Back Input button with inline JavaScript

WordPress by the Numbers Facts

Helping humans speak to the computer

By |2019-02-08T19:25:36-04:00March 19th, 2018|Categories: CMS, WordPress|Tags: , , , , , |

About the Author:

I am a loving father, & husband. I am a computer enthusiast. I have used and enjoyed computers since I was young and I enjoy teaching young minds how to code, because it teaches them how to think. Today with YouTube, and social media garbage our youth are losing the ability to think on their own and solve problems. I believe this is a serious epidemic as kids today dont understand that technology is a tool. This tool is being abused, and its underlying effects are taking its toll on kids behaviour, and learning.