Author
FWD:labs
Requirements
WordPress 4.9+, PayPal.com Account
Version (Last Updated)
1.00 (2017-11-17 09:10:11)
1. Add this code to your WordPress theme's functions.php file.
2. Use shortcode [paypal value="XXXXXXXXXX"] -- after replacing PayPal's unique "hosted button ID" for the X's -- in a post on WordPress and see the full PayPal form code on the published page.
3. Test your own button to ensure your hosted button ID is routing to your PayPal item.
function get_paypal($atts) { // default parameters extract(shortcode_atts( array('value' => ''), $atts)); if ($value) { $get_paypal = <<<EOD <form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input type="hidden" name="cmd" value="_s-xclick"><input type="hidden" name="hosted_button_id" value="'.$value.'"><input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"><img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"></form> EOD; return $get_paypal; } else { return null; } } add_shortcode('paypal','get_paypal');
Questions, comments, concerns or ideas about this? Please let us know.