Duplicate Snippet
Embed Snippet on Your Site
Add Donate Button
Template code to display a particular campaign's button.
Code Preview
php
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
Hi there, I’ve tried adding this to my website but can’t quite get it to work.
What do I need to change in the code to reference the specific campaign? Do I add a seperate snippet of code for each campaign I want to add?
Code snippet automatically creates a shortcode (something like [wpcode id="8330"]) so I assume I just add this as a short code?
Jordan,
The above snippet should be added “everywhere” in WPCode and then you can add the function to a page on your site (as noted in the top comments) in PHP:
ed_charitable_get_campaign_donate_button( 123 );
‘123’ would be the campaign ID. For this we reocmmend one button/modal per page. For a regular button in PHP that points to a campaign page, that’s more straightforward:
echo get_permalink( 123);
This is a WordPress function that should result in http://www.testsite.com/campaign – if you always have /donate you can simply add that (in this example of a potential button:r
<a href="”>Donate
There are no shortcodes involved here in terms of what to add. There ARE shortcodes to add a donation form, for example:r
https://www.wpcharitable.com/documentation/add-your-donation-form-to-a-page
I hope this helps.
Jordan,
Looks like the comment removed some of the HTML in my reply so here’s a screenshot after the “example of a potential button”: https://a.supportally.com/i/ha3O2I