• Resolved sarelmigael

    (@sarelmigael)


    I need code that calls the total donation amount (total of all donation forms) as a number variable as I would like to use that variable in a Divi bar counter module.

    Currently, I am using the following code “<div class=”custom total”>[give_totals ids=”1271,1277,1280,1285″ message=”{total}”]</div>”, which in my case generates the total donation amount, but with a £-sign in front of the number.

    This is obviously not compatible with the Divi bar module as it is a text string.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Matt Cromwell

    (@webdevmattcrom)

    Hi there,

    Currently, the [give_totals] shortcode will always output the currency with the number. I’m not familiar with the “Divi bar module” but if it’s showing a progress bar, the give_totals shortcode can do that as well. For example, you might try this instead:

    [give_totals ids=”1271,1277,1280,1285″ message=”{total}” progress_bar=”true”]

    This is explained in detail in our docs here:
    https://givewp.com/documentation/core/shortcodes/give_totals/

    Other than that, if you are a developer or work with one, you might consider building out your own custom shortcode that queries your total donations collected to date. We have some good sample code that can guide you on how to make that happen here:
    https://github.com/impress-org/give-snippet-library/blob/master/useful-queries/sample-transaction-queries.php

    Thanks!

    Thread Starter sarelmigael

    (@sarelmigael)

    Hi Matt,

    Thanks a lot for the prompt response. Okay, I will then rather use the give_totals shortcode to show the progress bar.

    I have one question regarding this give_totals bar – how do I change the colours of this bar, given that I am pulling data from the four forms (1271,1277,1280,1285)?

    Sarel

    Plugin Author Matt Cromwell

    (@webdevmattcrom)

    You’d need to target that with CSS, like this:

    .give-progress-bar>span {
        background-color: #2bc253;
    }

    If you’re enjoying Give and appreciate our support, we’d love a kind review from you here:
    https://www.ads-software.com/support/plugin/give/reviews/

    Thanks!

    Thread Starter sarelmigael

    (@sarelmigael)

    Hi Matt,

    Thanks, it does not work.

    Sarel

    • This reply was modified 5 years, 8 months ago by sarelmigael.
    Plugin Author Matt Cromwell

    (@webdevmattcrom)

    Can you point me to a live example where you show it not working? If you applied that CSS correctly it should work as intended, unless there are other styles from your theme that are conflicting. Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Total Donation Amount as Number Variable’ is closed to new replies.