Created
July 23, 2020 20:14
-
-
Save scyt/0f0441486b15afd37804c2344f493097 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Gravity Perks // Pay Per Word // Surprise, Pay Per Line! | |
* https://gravitywiz.com/documentation/gravity-forms-pay-per-word/ | |
*/ | |
gform.addFilter( 'gpppw_word_count', function( wordCount, text, gwppw, ppwField, formId ) { | |
// Pay per character instead of words. | |
var words = text.split( '\n' ); | |
return words == null ? 0 : words.length; | |
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Gravity Perks // Pay Per Word // Surprise, Pay Per Line! | |
* https://gravitywiz.com/documentation/gravity-forms-pay-per-word/ | |
*/ | |
add_filter( 'gpppw_word_count', function( $word_count, $words ) { | |
$words = explode("\n", $words); | |
return count( $words ); | |
}, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment