WordPress fundraising progress bar
Published Updated 2 min read
Charities, churches and community groups on WordPress often need exactly one thing: a bar that shows how far a campaign has come. Set a goal, enter what has been raised, let supporters see the progress.
A handful of plugins do it. Most are abandoned, locked behind a paid plan, or carry far more than a small fundraising page needs, and some have had security disclosures.
A shortcode goes anywhere: a page, a post, a widget area. One attribute for the goal, one for the amount raised, one for the label. No admin screen, no database table, nothing to configure except the raised figure as donations come in.
Three attributes and a bar
[fundraising_bar goal="5000" raised="1250" label="Roof Fund"] draws a horizontal bar filled to the percentage raised, with the label above it and the raised and goal amounts below. goal and raised are required; label is optional, and so is currency, a one to three character symbol that defaults to $: [fundraising_bar goal="10000" raised="4500" currency="€" label="Building Fund"].
It works anywhere WordPress processes shortcodes: a Shortcode block in the editor or a widget area, a Text widget in a classic sidebar, a classic editor page, or a template via do_shortcode.
The bar sits in a rounded track and fills left to right, with a short CSS transition. When raised meets or passes the goal, the fill stops at 100 percent and darkens, while the amounts still show the real total, so supporters can see the target was beaten. No external assets and no CDN calls.
Updating the total by hand
raised is a number in the shortcode. To update it, edit the page and change it. For a campaign taking a handful of donations a day that is nearly always fine: whoever processes donations knows the running total and updates the page when they log in.
There is no link to a payment processor, which is also why nothing breaks when a payment API changes or a gateway plugin updates. Showing the total is kept separate from collecting it. Reading the figure automatically from another plugin or a custom field would be a separate build.
Green by default, and yours to restyle
The defaults are a neutral grey track and a green fill that darkens at the goal, which sit comfortably on most themes. The CSS lives in the same file as the PHP, so a vertical thermometer, a brand colour, a thicker bar or the percentage printed inside the fill are all edits to that one file.
A follow-up build can turn the shortcode into a full block with inspector controls, so editors change the goal and raised amount from the block sidebar.
Taking donations is GiveWP's job
If the same plugin needs to take the donations, look at GiveWP or Charitable. They handle donation forms, payment gateways, receipts, donor management and reporting, with a progress display as one feature among many.
This shortcode shows a number you provide. It does not read totals from GiveWP, Charitable, WooCommerce or anything else; if your donation form already records contributions, pulling that total in automatically needs a small bridge.
For a small charity running one campaign at a time and updating the figure weekly, the shortcode is the simpler choice. For an organisation with dozens of concurrent campaigns that must update in real time, it is not.
What you get
Included
- A [fundraising_bar] shortcode that renders a visual progress bar with goal, raised amount, and an optional label
- Percentage fill calculated from raised divided by goal, capped at 100%
- A goal-reached visual state when raised meets or exceeds the goal
- Currency symbol as a shortcode attribute, defaulting to $
Not included
- Connecting to any payment plugin or gateway to update the raised amount automatically
- Storing donation records or donor information
- A live total pulled from GiveWP, Charitable, WooCommerce, or any other plugin
- Multiple campaigns managed from a central admin screen
- Donation form functionality: this plugin displays progress only, it does not accept payments
Thermometer does the things on the right. This build covers the part most sites use.
Build it in Steem
The button opens the builder with this guide's prompt filled in, so you can change anything before it runs. Nothing is built, and nothing is charged, until you send it.
Read the prompt (201 words)
Build a WordPress plugin called Fundraising Progress Bar. Plugin Name: Fundraising Progress Bar. Description: Shows a visual fundraising progress bar via a shortcode. Single PHP file. No dependencies. Register a shortcode with tag fundraising_bar. Accept these attributes with defaults via shortcode_atts: goal (default empty string), raised (default empty string), label (default empty string), currency (default "$"). Sanitize: goal and raised with floatval, label with sanitize_text_field, currency with sanitize_text_field then mb_substr to 3 characters. If $goal is zero or empty after floatval, return an empty string. Calculate: $pct = min( ( $raised / $goal ) * 100, 100 ); $pct_display = round( $pct ); $raised_fmt = number_format( $raised, 0 ); $goal_fmt = number_format( $goal, 0 ); Build output as a string: - Outer div: class="fundraising-bar-wrap" data-pct="{$pct_display}". Add class fundraising-bar-complete if $pct >= 100. - If label non-empty: <p class="fundraising-bar-label"> containing the label. - <div class="fundraising-bar-track"><div class="fundraising-bar-fill" style="width:{$pct}%" role="progressbar" aria-valuenow="{$pct_display}" aria-valuemin="0" aria-valuemax="100"></div></div> - <p class="fundraising-bar-amounts">{$currency}{$raised_fmt} raised of {$currency}{$goal_fmt} goal</p> Return the string (do not echo). On wp_enqueue_scripts: call wp_register_style( 'fundraising-bar', false ), then wp_enqueue_style( 'fundraising-bar' ), then wp_add_inline_style( 'fundraising-bar', $css ) where $css is: .fundraising-bar-wrap{margin:1.5em 0}.fundraising-bar-label{font-weight:600;margin-bottom:.4em}.fundraising-bar-track{background:#e0e0e0;border-radius:4px;height:1.5em;overflow:hidden}.fundraising-bar-fill{background:#4caf50;height:100%;transition:width .3s ease}.fundraising-bar-complete .fundraising-bar-fill{background:#388e3c}.fundraising-bar-amounts{margin-top:.4em;font-size:.9em;color:#555} No settings page. No admin menu. No database tables. No AJAX. No inline JS.
Steem