The Donation Leaderboard shortcode allows you to easily display a dynamic and customizable donation leaderboard on your website or platform. This shortcode is especially useful for showcasing top donors, encouraging healthy competition among contributors, and recognizing those who have generously supported your cause or project.
[wcdp_leaderboard split="5" limit="20"]
- Nadia donated $5.00
4 weeks ago - Carlos donated $10.00
2 months ago - Susan donated $95.00
3 months ago - Kai donated $50.00
3 months ago - Daniel donated $65.00
3 months ago - Elijah donated $45.00
3 months ago - Layla donated $80.00
3 months ago - Lucia donated $50.00
3 months ago - Anna donated $50.00
3 months ago - Martha donated $70.00
3 months ago - Linda donated $75.00
3 months ago - Maria donated $90.00
3 months ago - Sarah donated $60.00
3 months ago - Matthew donated $90.00
3 months ago - Eva donated $50.00
3 months ago - Sofia donated $20.00
3 months ago - Johanna donated $45.00
3 months ago - Maria donated $10.00
3 months ago - Sarah donated $85.00
3 months ago - Mary donated $5.00
3 months ago
By default, this shortcode will generate a leaderboard displaying the last 10 donations based on the standard settings. However, you can fully customize the display using various attributes.
limit
(optional):- Specifies the number of top donors to display on the leaderboard.
- Default: 10
- Example:
{wcdp_leaderboard limit="5"
} will display 5 donations.
id
(optional):- Specifies the ID of the products associated with donations to consider.
- Default: “-1” (any product)
- Example:
{wcdp_leaderboard id="1"
} will display the leaderboard for specific products.
orderby
(optional):- Determines the sorting order of the leaderboard.
- Values: “date” or “total”
- Default: “date”
- Example:
{wcdp_leaderboard orderby="total"
} will display the leaderboard based on order total (so not just the amount of the donation item)
style
(optional):- Sets the style of the leaderboard.
- Values: 1 or 2
- Default: 1
- Example:
{wcdp_leaderboard style="2"}
will display the leaderboard in an alternative style.
split
(optional):- Divides the leaderboard, revealing the next x donations in the list.
- Default: -1 (disabled)
- Example:
{wcdp_leaderboard split="5"}
will split the leaderboard to show the next 5 donations on demand.
button
(optional):- Defines the text of the “Show more” button for split leaderboards. Only has an effect when split is set.
- Default: “Show more”
- Example:
{wcdp_leaderboard split="10" button="Load additional donations"}
Please do not forget to use [] instead of {}
Setting Global Leaderboard options
Please do not forget to set the global leaderboard settings via the plugin settings page. You can disable the heading/description by leaving it blank.
Placeholders
You can use the following placeholders (using {}) in the input fields to dynamically display specific information:
{firstname}
: Display the first name of the order.{firstname_initial}
: Display the initial of the first name.{lastname}
: Display the last name of the order.{lastname_initial}
: Display the initial of the last name.{company}
: Display the company associated with the order.{company_or_name}
: Display the company name or individual’s name.{amount}
: Display the order total amount.{timediff}
: Display the human-readable time difference from the order date (e.g. 1 week ago){datetime}
: Display the order date and time.{date}
: Display the order date.{city}
: Display the donor’s city.{country}
: Display the donor’s country.{country_code}
: Display the country code associated with the order.{postcode}
: Display the postal code associated with the order.{currency}
: Display the currency code associated with the order.{comment}
: Display the order note.{anonymous}
: Display a message indicating an anonymous donor (just returns “Anonymous donor” in a stylable tag).
Anonymous / public donation
You can show different text based on if users checked the anonymous / public checkbox on checkout. You have to enable this checkbox first.
Let’s say you only want to show the name of the user only when the checkbox is checked (opt-in):
- Activate the checkbox
- Set text of checkbox to “Show my name publicly in the leaderboard”.
- Set “Leaderboard item heading (Checkout checkbox checked)” to e.g. “{firstname} {lastname} donated {amount}”
- Set “Leaderboard item heading (Checkout checkbox unchecked)” to e.g. “Someone from {city} donated {amount}”
- Set “Leaderboard item description” to e.g. “{timediff}” (will apply in both cases)
If you want to show the name of the donor when the checkbox is unchecked (opt-out) please use a setup similar to this:
- Activate the checkbox
- Set text of checkbox to “Do not show my name in the leaderboard”.
- Set “Leaderboard item heading (Checkout checkbox checked)” to e.g. “Anonymous donation from {city}”
- Set “Leaderboard item heading (Checkout checkbox unchecked)” to e.g. “{firstname} {lastname} donated {amount}”
- Set “Leaderboard item description” to e.g. “{timediff}” (will apply in both cases)