Documentation

Output format filter

Is there a filter to change the output?

Yes, you can use the following data to filter the results:

Filter hook is named ‘gwp_count_result’. Followed by the callback function which holds 3 arguments:
1: $formatted_value, the default output value of the count.
2: $raw_value, the raw unformatted output value of the count.
3: $formids, an array with the ID’s of the coounted forms.

Example: For form with ID 1, unformatted values are compared with the number 10. Values lower than 10 are returned as formatted and in a red styling.
When the value is 10 or higher, the formatted value is returned without a styling.

add_filter(
    'gwp_count_result',
    function( $formatted_value, $raw_value, $formids ) {

        if ( $raw_value < 10 && $formids['0'] === '1' ) {
            return '<span style="color:red;">' . $formatted_value . '</span>';
        } else {
            return $formatted_value;
        }
    },
    10,
    3
);
Countv0.9.8

For this plugin you need to install the free GravityWP - Count from the WordPress repository.

Read more