Charitable Documentation

Learn how to make the most of Charitable with clear, step-by-step instructions.

Campaign Donate Button

Note: Might need to rename “Modal Donation Button” here and “Campaign Modal Button” to simply “Campaign Donation Button”.

The Modal Donate Button (also referred to as Campaign Modal Button in release notes) lets you place a button that opens a donation form in a modal popup—or links directly to the campaign donation page—anywhere on your site. It is available as both a WordPress block and a shortcode, and is part of Charitable’s Universal Modal Donation System.

Table of Contents

Requirements

  • Charitable Pro: Version 1.8.13 or higher
  • WordPress: Version 6.2 or higher
  • PHP: Version 7.4 or higher

Getting Started

Block: Edit a page or post in the Block Editor → add block → search for Modal Donate Button or Charitable → insert the block → choose a campaign and configure the button in the sidebar.

Shortcode: Use [charitable_modal_button campaign_id="123"] in any post, page, or widget. Replace 123 with your campaign ID. You can add optional attributes for button text and CSS classes (see Shortcode).

Key Benefits

  • Place anywhere: Buttons in sidebars, footers, campaign grids (e.g. Campaign Showcase), or inline content.
  • Modal or link: Block lets you choose “Modal Popup” (donation form in a popup) or “Link to Donation Page” (normal link). Shortcode is modal-only.
  • No page reload: In modal mode, the form loads via AJAX and opens in an overlay; donors stay on the same page until they submit or close.
  • Campaign Selector control: When Campaign Selector is enabled globally, you can hide it for a specific button so the modal shows only the chosen campaign.

Block (Editor)

The block is registered as Modal Donate Button (charitable/modal-donate-button) under the Widgets category.

Block settings (sidebar)

Settings

  • Campaign – Required. Select the campaign this button will use for donations.
  • Button Text – Label on the button (default: “Donate Now”).
  • Button Action
    • Modal Popup – Click opens the donation form in a modal (default).
    • Link to Donation Page – Click goes to the campaign’s donation page.
  • Open in New Tab – Only when Button Action is “Link to Donation Page.” Opens the donation page in a new tab.
  • Hide Campaign Selector – Only when Button Action is “Modal Popup.” When enabled, the campaign selector dropdown is hidden in this modal even if it’s enabled in Charitable settings.

Colors

  • Background – Button background color.
  • Text – Button text color.
  • Border – Button border color.

Hover

  • Background – Button background on hover.
  • Text – Button text color on hover.

Size & Spacing

  • Button Width – e.g. auto100%200px.
  • Font Size – e.g. 16px1.2em.
  • Border Radius – e.g. 4px25px.
  • Horizontal Padding – e.g. 24px2em.
  • Vertical Padding – e.g. 12px1em.

Advanced

  • Custom CSS Class – Extra class(es) on the button element.
  • Modal CSS Class – Only when Button Action is “Modal Popup.” Extra class(es) on the modal container (default modal class is charitable-universal-modal).

The editor shows a preview of the button and the selected campaign name. On the frontend, the block outputs the same behavior as the shortcode (in modal mode) or a styled link (in link mode).

Shortcode

Shortcode name: charitable_modal_button

Required attribute

  • campaign_id – The campaign ID. The button will open the donation form for this campaign in a modal.

Optional attributes

AttributeDescriptionDefault
textButton label.“Donate Now”
classAdditional CSS class(es) for the button.
modal_classAdditional CSS class(es) for the modal container.

Examples

[charitable_modal_button campaign_id="42"]
[charitable_modal_button campaign_id="42" text="Give to this campaign"]
[charitable_modal_button campaign_id="42" class="my-donate-btn" modal_class="my-modal"]

Note: The shortcode always opens the donation form in a modal. To link to the donation page instead, use the block with Button Action set to “Link to Donation Page,” or use the standard donate link/shortcode (e.g. [charitable_donate_button] with the appropriate campaign and link behavior).

How the Modal Works

  1. Trigger: The button has the class charitable-modal-trigger and a data-campaign-id attribute. The Universal Modal script listens for clicks on this class.
  2. Load: On click, the script loads the donation form via AJAX for the given campaign and injects it into the modal overlay.
  3. Display: The modal opens (using the same overlay and structure as Charitable’s existing modals). Donors can complete the form or close the modal.
  4. Campaign Selector: If the Campaign Selector feature is enabled in Charitable settings and not overridden by the button (see below), the form can show a dropdown to switch campaigns. Individual buttons can force-hide it with the block’s “Hide Campaign Selector” option or by passing data-hide-campaign-selector when building the button in code.

The modal uses the Universal Modal Donation System (Charitable Pro 1.8.13+), so it works consistently whether the button is from the block, the shortcode, or from other features (e.g. quick-donate buttons in the Campaign Showcase block).

Campaign Selector in the Modal

  • Global setting: Charitable Settings → General → Donation Form → Campaign Selector. When enabled, donation forms can show a “Choose a Campaign” dropdown.
  • Per-button override (block only): In the Modal Donate Button block, when Button Action is “Modal Popup,” enable Hide Campaign Selector to hide that dropdown for this button’s modal. Useful when the button is for a single campaign and you don’t want the selector in the popup.
  • Shortcode: The shortcode does not expose a “hide campaign selector” attribute. To hide it for a shortcode button, you would need to add a custom CSS class and use JavaScript to set data-hide-campaign-selector on the trigger, or use the filter charitable_modal_donate_button_html to add the data attribute.

Troubleshooting

Button does nothing when clicked

  • Confirm the campaign ID is valid and the campaign is published.
  • Ensure the Universal Modal script is loaded (no script errors or aggressive removal of Charitable scripts on that page).
  • Check the browser console for JavaScript errors when clicking the button.

Modal doesn’t open or form doesn’t load

  • Verify you’re on Charitable Pro 1.8.13+ and that no plugin/theme is blocking charitable-universal-modal or the AJAX request that loads the form.
  • Test with a default theme and other plugins disabled to rule out conflicts.
  • Ensure the campaign can receive donations (e.g. not ended, not fully funded if that blocks donations).

Button looks wrong or styling is missing

  • Use the block’s ColorsSize & Spacing, and Advanced (custom class) options to adjust appearance.
  • For the shortcode, add a class and style that class in your theme or custom CSS. The trigger uses the class charitable-modal-trigger plus any classes you pass.

“Link to Donation Page” not available

  • That option exists only on the block. The shortcode [charitable_modal_button] is modal-only. For a simple link to the donation page, use the block with Button Action = “Link to Donation Page” or your theme’s/plugin’s donate link for that campaign.

Developer Resources

PHP

  • Template function: charitable_get_modal_donate_button( $campaign_id, $args ) – Returns the button HTML. Used by the shortcode and block.
  • Echo helper: charitable_modal_donate_button( $campaign_id, $args ) – Echoes the same HTML.

Arguments for charitable_get_modal_donate_button:

KeyTypeDefaultDescription
textstring“Donate Now”Button label.
classstringcharitable-modal-triggerCSS class(es) for the button.
modal_classstringcharitable-universal-modalCSS class for the modal container.
button_tagstringbuttonbutton or a.
stylestring''Inline style string for the button.
hide_campaign_selectorboolfalseWhen true, adds data-hide-campaign-selector="1"so the modal hides the campaign selector.

Filters

  • charitablemodaldonatebuttonshortcode_output – Filter the shortcode output. Parameters: $output$args.
  • charitablemodaldonatebuttonhtml – Filter the button HTML from charitable_get_modal_donate_button. Parameters: $button_html$campaign_id$args.

CSS / HTML

  • Button: The trigger has class charitable-modal-trigger and attributes data-campaign-id, optionally data-modal-classdata-hide-campaign-selector.
  • Block wrapper: .wp-block-charitable-modal-donate-button.
  • Modal: The overlay and modal container are created by the Universal Modal script; the modal uses the class you pass (e.g. charitable-universal-modal).

Version history

VersionChanges
1.8.13Modal Donate Button block and shortcode; Universal Modal Donation System; block supports Modal Popup vs Link, styling, Hide Campaign Selector; charitable_get_modal_donate_button gains style and hide_campaign_selector.

For global donation form and Campaign Selector settings, see Campaign Selector. For embedding full donation forms (not in a modal), see the donation form and campaign shortcode documentation.

Still have questions? We’re here to help!

Last Modified:

What's New In Charitable

🔔 Subscribe to get our latest updates
📧 Subscribe to Emails

Email Subscription

Join our Newsletter

We won’t spam you. We only send an email when we think it will genuinely help you. Unsubscribe at any time!

Donations Live New

👉🏻 Showcase Real Momentum with the Donations Feed

Give your donors a reason to trust. Our new feed lets you display a living, breathing record of people showing up for your cause.

🤝 Build instant trust: Overcome donor hesitation by showing a proven track record of community support.
💬 Highlight donor stories: Display real donor comments and locations to show the human side of your fundraising.
🛠️ Drop it anywhere: Easily add the block to your homepage, campaign pages, or confirmation screens in seconds.
📈 Curate your feed: Group multiple donations from the same person or sort by highest amounts to encourage larger gifts.

Campaigns New

🎨 Campaign Showcase: Pro Level Display, No Coding Needed.

Display your causes with style and make it easier than ever for donors to find the right campaign. We are excited to announce the brand-new Campaign Showcase, a powerful, no-code tool designed to help you create beautiful, high-converting campaign grids and carousels.

The Ultimate Discovery Experience

Your mission deserves to be seen. With the Campaign Showcase, you can move beyond simple lists and create dynamic displays that highlight your most urgent needs, helping donors connect with the causes they care about most.

⚡ No-Code Customization: Effortlessly change layouts, columns, and styles with a single click. Whether you want a clean grid or an interactive carousel, you can match your organization’s look without any CSS or JavaScript.

🎯 Advanced Search & Filter: Empower your supporters with real-time filtering. Donors can quickly sort through campaigns by tags, popularity, or “ending soon,” making it easy to find exactly where their help is needed.

💰 Quick Donate Integration: Boost your conversions with instant giving. The Showcase allows donors to contribute via a modal popup directly from the display, featuring pre-selected amounts for a faster, friction-free experience.

Addon New

🤯 New Addon: Campaign Updates

Keep your supporters informed and engaged with every step of your progress! Share the ongoing impact of your mission and build lasting trust with your donor community!

The Ultimate Engagement Tool

Fundraising is a journey, not a one-time event. Now, you can easily provide real-time updates directly on your campaign pages, ensuring your donors stay connected to the causes they care about most.

📣 Easy Storytelling: Quickly post text updates, milestones, or field reports to show exactly how donations are being put to work, keeping the momentum alive throughout your fundraiser.

🏗️ Visual Builder Integration: Seamlessly add the Updates block anywhere on your page using our drag-and-drop builder, or use a simple shortcode to display news in widgets and sidebars.

📩 Build Donor Trust: By consistently sharing progress and success stories, you create a transparent giving experience that encourages recurring support and deeper community involvement.

Integration New

Build Beautiful Fundraising Pages Visually with WPBakery Integration

We are excited to announce our brand-new integration with WPBakery, one of the most popular WordPress page builders, designed to help you create stunning layouts for your campaigns without touching a single line of code.

The Ultimate Design Experience

Designing your nonprofit’s website should be as simple as your mission is powerful. Now, you can bring Charitable functionality directly into your WPBakery workflow, using native elements to build high-converting donation pages and campaign grids in seconds.

🖱️ Drag-and-Drop Building: Easily add donation forms, campaign progress bars, and “Donate Now” buttons to your layouts using the WPBakery elements you already know and love.

🎨 Total Creative Control: Customize the look and feel of your fundraising elements using WPBakery’s native design options. Adjust margins, padding, and borders to ensure your campaigns fit perfectly with your site’s branding.

📱 Seamlessly Responsive: Every element is built to be fully responsive and mobile-friendly, ensuring your donors have a smooth, professional experience whether they are giving from a phone, tablet, or desktop.

Integration New

🖼️ Add Image Galleries to Fundraising Campaigns With Envira Gallery

Showcase the impact of your mission like never before. We are excited to announce our brand-new integration with Envira Gallery, the best WordPress gallery plugin, designed to help you tell your story through powerful, high-performance visuals.

The Ultimate Storytelling Experience

A picture is worth a thousand words – and now, it’s worth even more for your fundraising. Connect your visual impact directly to your cause by creating stunning, responsive galleries that engage donors and drive contributions.

🖼️ Visual Impact: Easily create beautiful, fast-loading galleries to show your nonprofit’s work in action, from field reports to event highlights.

🔗 Seamless Connection: Link gallery images directly to your fundraising campaigns, making it effortless for inspired visitors to go from viewing a photo to making a donation.

📱 Perfectly Responsive: Whether your donors are on a phone, tablet, or desktop, your galleries will look professional and load lightning-fast, ensuring a smooth experience on every device.