The [charitable_donate_button]
shortcode allows you to display a button or link to a campaign. This was introduced in Charitable 1.8.2.
Parameters
campaign
: The Id of the campaign the donation button is associated with.label
: The text that appears on the button or in the link. Defaults to “Donate”.new_tab
: Determines if a new tab opens when a user click on the button/link. Acceptstrue
orfalse
. Defaults tofalse
.css
: Allows you to add additional CSS to the HTML element (multiple elements should be separated by a single space).type
: This determines if the shortcode outputs a button or a text link. Accepts link or button. Defaults to button.
Usage
Default usage:
[charitable_donate_button
]
A button labeled “Please Donate” that will open up a new browser tab/window to the campaign that has an ID of 1235.
[charitable_donate_button campaign="1235" label="Please Donate" new_tab="true"]
A link labeled “Please Donate Again” that opens up a new browser tab/window. This link has a custom CSS class:
[charitable_donate_button campaign="1235" label="Please Donate Again" type="link" css="my-text-link" new_tab="true"]
Additional Notes
Note that this shortcode will only produce the HTML element – meaning that how this button or link is displayed might depend on where you insert the shortcode. In most themes this button/link will appear as a inline element.