[wp-hackers] limit characters

Silverstein, Jesse Jesse.Silverstein at xerox.com
Mon Apr 6 22:55:16 GMT 2009


This would probably be best achieved by a plugin. This is how I would
write said plugin:

On some action (admin-head or admin-head-(page-hook) ?) enqueue the
maxlength js, and your own plugin's js (needs to be after jquery, so add
as a requirement). Then add a filter somewhere during the
edit-form-advanced (maybe "the_editor") to put in a hidden "maxlength"
field for the maxlength js. Your plugin's js should 1) add a span with
appropriate ID inside the td with id="wp-word-count" after the
word-count.js has added its own span. See wp-admin/js/word-count.js for
reference there. Then 2) trigger the maxlength plugin (safest after page
load has finished).

Also, I think you will want to make sure this only happens if
user_can_richedit().

Good luck!

-Jesse Silverstein

-----Original Message-----
From: wp-hackers-bounces at lists.automattic.com
[mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of El Carpo
Blues
Sent: Monday, April 06, 2009 6:05 PM
To: wp-hackers at lists.automattic.com
Subject: [wp-hackers] limit characters

hi there!
i just entered the list 'cause i need your help

Is there a way to limit the amount of characters in a wordpress post? I
mean, limit the amount of characters WHEN WRITING A POST, something like
integrating the maxlength
plugin<http://remysharp.com/2008/06/30/maxlength-plugin/>into
wordpress edit-form-advanced.php... I know those kind of scripts work
with textarea, but i can't find the textarea tag on wordpress...

if there is no way to achieve this, it also could be useful a way to
count
the characters i'm actually writing...

thank you!
_______________________________________________
wp-hackers mailing list
wp-hackers at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers

No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.0.238 / Virus Database: 270.11.43/2043 - Release Date:
04/06/09 06:22:00


More information about the wp-hackers mailing list