[wp-hackers] limit characters

El Carpo Blues elcarpo.blues at gmail.com
Mon Apr 6 23:26:50 GMT 2009


thank you!

On Mon, Apr 6, 2009 at 8:20 PM, Silverstein, Jesse <
Jesse.Silverstein at xerox.com> wrote:

> Sounds like this will be a great learning experience for you :)
>
> An alternative to hooking the "the_editor" filter would be to just slap
> in a hidden input field from your plugin's js file. That means all you
> need to do in PHP is enqueue your two js scripts for the right page, and
> the rest is javascript. Although this is only an better alternative if
> you are more comfortable with javascript than php. Otherwise it's six of
> one, half a dozen of the other.
>
> P.S. refer to wp-admin/js/word-count.dev.js not word-count.js. The
> former is (more) legible.
>
> -Jesse
>
> -----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 7:09 PM
> To: wp-hackers at lists.automattic.com
> Subject: Re: [wp-hackers] limit characters
>
> jesse, thanks...
> problem is, don't know how to write a plugin :S
>
> anyway, i'll give it a try, and see what happens...
>
> On Mon, Apr 6, 2009 at 7:55 PM, Silverstein, Jesse <
> Jesse.Silverstein at xerox.com> wrote:
>
> > 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
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
>
>
>
> --
> Pasate por http://www.democraciachina.com.ar
> _______________________________________________
> 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 18:59:00
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
Pasate por http://www.democraciachina.com.ar


More information about the wp-hackers mailing list