Return to Snippet

Revision: 57579
at June 1, 2012 14:49 by planetabhi


Initial Code
// paypal donate button
function cwc_donate_shortcode( $atts ) {
    extract(shortcode_atts(array(
        'text' => 'Make a donation',
        'account' => 'REPLACE ME',
        'for' => '',
    ), $atts));

    global $post;

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

    return '<a class="donateLink" href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business='.$account.'&item_name=Donation+for+'.$for.'">'.$text.'</a>';

}
add_shortcode('donate', 'cwc_donate_shortcode');

Initial URL


Initial Description
Add this snippet to the functions.php to add 'Donate' Button on your Wordpress Website.

Initial Title
Add PayPal Donate button to your Wordpress Website

Initial Tags
wordpress

Initial Language
PHP