Here’s how it looks when someone posts with a really long name..
Messes up the whole site.. 🙁
http://img217.imageshack.us/img217/8884/20090219200735ao4.png
This should do the trick: in either your themes header.php or functions.php add the following piece of code
add_filter('get_comment_author',create_function('$author','return substr($author,0,40)');)
The 40 can be changed to change the maximum limit of the authors name.
I haven’t tested this myself but it should work!
It works, awesome! Thx alot ;D
Btw if anyone wanna copy this code there was a small typo, the semicolon in the end was misplaced and the code should be
add_filter('get_comment_author', create_function('$author','return substr($author,0,25);'))
If you want it to work 🙂
Sorry about the typo! It was written in a bit of a rush but I’m glad it works!
How does a novice like myself actually add that code? Do I do it like this?
<?php add_filter(‘get_comment_author’, create_function(‘$author’,’return substr($author,0,25);’))>
?????????????
Do it like this:
<?php add_filter('get_comment_author', create_function('$author','return substr($author,0,25);')); ?>
Thank you jcow. I will try that and return with the results.
(@conditionkill)
17 years, 3 months ago
How can I limit name length on comment authors?