Limit the number of words in the answers
I don’t know if there’s a function to do it. But you can do it including the maxlength attribute, o with jQuery.
But if you change the attribute, you are changing the php, so it will be override with the next update.
http://stackoverflow.com/questions/1363030/can-i-specify-maxlength-in-css
http://jsfiddle.net/TmsXG/13/
Yeah, my bad. I’m pretty sure it can be done with javascript, but that is not my area, sorry…
Thanks! 😉
I have found this function:
function minWord($content){ global $post; $num = 100; //set this to the minimum number of words $content = $post->post_content; if (str_word_count($content) < $num) wp_die( __('Error: your post is below the minimum word count.') ); } add_action('publish_post', 'minWord');
Is it possible to change it to make it work the opposite?
Thanks!!!
function minWord($content) {
global $post;
$num = 140; //set this to the maximun number of words
$content = $post->post_content;
if (str_word_count($content) > $num) wp_die( __(‘your error message here.’) );
}
add_action(‘publish_post’, ‘minWord’);
This way show error with more of 140 words, but I don’t know where or how implement this function.
Thanks!
I will try! 😉
Thanks for your quick answer! 😉
But I need limit “words”… “maxlength” only works with characters… 🙁
Rgds!