Donation Shortcode With Post Title In Donation Link
Thanks for this handy little shortcode! Works like a charm.
I made a small modification to the plugin to get it working with post titles in the donate link and thought I would share it. 🙂
In the paypal-donation-shortcode.php file I changed:
“title” => ‘Donation’
“title” => ‘ ‘
I then added the following 2 lines above $content = “”;
global $post; if (!$title) $title = str_replace(" ","+",$post->post_title);
When I use the shortcode I simply don’t include title attribute and it inserts my post title.
So, instead of shortcode example:
[paypal text=”Do you like this plugin? Please reward it with a little donation.” email=”email@example.com” title=”Donation for Paypal Donation Shortcode plugin” currency=”USD”/]
use something like (without title attribute):
[paypal text=”Do you like this plugin? Please reward it with a little donation.” email=”firstname.lastname@example.org” currency=”USD”/]
(This won’t effect users who want to continue to set their title using the title attribute, it’s only for when the title attribute is not used).
- The topic ‘Donation Shortcode With Post Title In Donation Link’ is closed to new replies.