• Resolved j0c43n

    (@j0c43n)


    Hello,

    I’m using GiveWP on a charity website which is available in two languages by using the plugin polylang. I have created one form for each language for the same campaign (ie two forms) and added them to the specific sites.
    Now I would like to display a progress bar or the result how much money has been raised so far in total (both languages) below the donation form. Therefore, I would like to use one of the shortcodes [give_multi_form_goal] or [give_totals] and use the ID argument to insert the IDs of the forms. Unfortunately the result always shows 0 as soon as I enter the argument ID in the shortcode although some money has already been raised.
    Do you have an idea of what I’m doing wrong?

    `[give_totals id=”221,222″ total_goal=”6000″ progress_bar=”true”]’

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Rick Alday

    (@mrdaro)

    Hi @j0c43n,

    Happy to help.

    What’s going on is that the shortcode is calculating the total from the form in the base language only.

    Use this snippet to have it read the totals from all the forms in the ID list.

    function give_polylang_total_goal_shortcode_args( $args ) {
    	$args['lang'] = '';
    
    	return $args;
    }
    add_filter( 'give_totals_goal_shortcode_query_args', 'give_polylang_total_goal_shortcode_args' );

    If you need assistance implementing custom PHP code on your website we have this guide:

    https://givewp.com/documentation/resources/adding-custom-functions-to-your-wordpress-website/

    Please note that this code snippet is provided as an example of how you can extend GiveWP with code. It’s up to you to implement and customize to your liking. We cannot provide support for custom code on your website, only the code that we create and distribute.

    Thread Starter j0c43n

    (@j0c43n)

    Great stuff @mrdaro! Works perfectly.
    Thank you so much!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Unable to filter forms in shortcodes by ID’ is closed to new replies.