gform_polls_percentage_precision

Description

Allows the percentages on the front-end Polls results to be rounded to a custom number of decimal digits. The percentage is rounded to the nearest whole number by default.

Usage

add_filter('gform_polls_percentage_precision', 'your_function_name', 10, 2);

Parameters

  • $precision int
    The number of decimal digits to use.

  • $form_id int
    The form id.

Examples

add_filter('gform_polls_percentage_precision', 'gform_polls_custom_precision', 10, 2);
function gform_polls_custom_precision( $precision, $form_id ){
    return 1;
}

Placement

This code should be placed in the functions.php file of your active theme.

Since

This filter was added in the Gravity Forms Polls Add-On version 2.

Source Code

This filter is located in GFPolls::gpoll_get_data() in gravityformspolls/class-gf-polls.php