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 Character! | |
* 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( '' ); | |
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 Character! | |
* https://gravitywiz.com/documentation/gravity-forms-pay-per-word/ | |
*/ | |
add_filter( 'gpppw_word_count', function( $word_count, $words ) { | |
$words = str_split( trim( $words ) ); | |
return count( $words ); | |
}, 10, 2 ); |
i have written the gp-pay-per-word-i-mean-character.php code in my function.php file
@mohitit Drop us a line via support: http://gravitywiz.com/support/ We'll be happy to dig in.
should i open a ticket at https://www.gravityforms.com/open-support-ticket/?
@mohitit I posted the link to our support in my last.
Where does the js go? I use snippets for the php part.
You can HTML Block in form and add js block there
Thank you!
FYI: This snipped does not work with every character. See my pull request here: gravitywiz/snippet-library#403
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hello David,
Thanks! for the help...One minor issue ...One the Gravity form the prices are coming fine...But in the notification email the price is still coming according to pay per word..