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
The background-color CSS property
How to Define a percent surcharge by delivery country with WooCommerce
How to make a Go-Back Input button with inline JavaScript