Skip to content

Instantly share code, notes, and snippets.

@billrobbins
Created March 12, 2014 01:16
Show Gist options
  • Save billrobbins/9498683 to your computer and use it in GitHub Desktop.
Save billrobbins/9498683 to your computer and use it in GitHub Desktop.
// PayPal Donate Shortcode
function elite_paypal_donation_shortcode( $atts ) {
extract(shortcode_atts(array(
'label' => 'Make a donation',
'email' => 'Account Email Address',
'for' => 'Donation',
), $atts));
global $post;
if (!$for) $for = str_replace(" ","+",$post->post_title);
return '<p><a class="button" href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business='.$email.'&item_name='.$for.'">'.$label.'</a></p>';
}
add_shortcode('donate-paypal', 'elite_paypal_donation_shortcode');
// Button Shortcode
function elite_button_shortcode( $atts ) {
extract(shortcode_atts(array(
'label' => 'Button',
'url' => '#'
), $atts));
global $post;
if (!$for) $for = str_replace(" ","+",$post->post_title);
return '<p><a class="button" href="'.$url.'">'.$label.'</a></p>';
}
add_shortcode('button', 'elite_button_shortcode');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment