in WordPress

Add Paypal Donate Wordpress Shortcode

Paypal In a previous post we had a snippet on how you can make money on your Wordpress blog by placing Google Adsense on your website. This snippet was a shortcode so you can add the Google Adsense anywhere in your content. In this article there will be another Wordpress shortcode on making money by using the Paypal donate functionality. This is when you have a button on your website where people can donate money to you which goes directy into your paypal account. All you have to do is copy the following in your functions.php file and you can use the shortcode in your content.

function paypal_donate( $atts ) {  
        'text' => 'Make a donation',  
        'account' => 'Add your account name here',  
        'for' => '',  
    ), $atts));  

    global $post;  

    if (!$for) $for = str_replace(" ","+",$post->post_title);  

    return '<a class="paypal_donate" href="'.$account.'&item_name=Donation+for+'.$for.'">'.$text.'</a>';  

add_shortcode('donate', 'paypal_donate');  

Now in your content you can use the shortcode


Upgrade to access all content on Paulund

Members unlock all tutorials and snippets

Access to all downloadable content

Access to code examples before others

Sign Up Now

Already a member? Login here

Subscribe To The Weekly Newsletter

Get weekly updates to your email