Wordpress sets a default limit of 55 characters for Excerpts.
You can override this limit by adding this code to your functions.php file in a child theme
Where to copy/paste this code?
We strongly recommend you create a child theme and add this to the Child Theme functions.php.
Download a start-up child theme here.
Remember: you shouldn’t edit the theme’s functions.php.
//Change WordPress Excerpt length function your_excerpt_length( $length ) { return 200; } add_filter( 'excerpt_length', 'your_excerpt_length' );
Change the 200 to whatever you need.
6 thoughts on “Override / filter Excerpt 55 chars length default”
Hi Dave, thank you for your reply. You are correct. My confusion was about terminology. The meanings of words in WP vernacular is quite specific. However, for the uninitiated newcomers (such as myself), I understand word “excerpt” as in natural (English) language — and that’s quite generic. Regardless, @acub was kind and patient to resolve my issue in this post in the forum.
Of course, I still wish I could override the max. limit of the truncated feature text on front page programmatically in the child functions.php. But apparently, this cannot be done now. Personally, I am reluctant to hack the actual sources of the theme. It is not the right approach, and so I will live with the limitation of 200 chars for now. @Nikeo assures us that a customizable hook will be provided in the future version. That would be outstanding!
Is there a recommended plugin or method of adding CUSTOM excerpt boxes to each page/post where we can type something completely different?
Thanks a bunch!
Hi Matt, in WordPress, there’s a built in custom excerpt for posts (in the post edit screen, you might have to acivate this box in the screen options at the top) that you can use.
For pages, add the following code to your functions.php file, this will add a custom box to your pages to create custom excerpt :
Hope this will help
D’oh! *headsmack*
I knew the functionality was there…but for the life of me couldn’t find it again–I always overlook that screen options tab, and assumed the excerpts must’ve been a function of a previous theme.
You rock, thanks as always sir.
-Matt
Hello Nicholas and Dave. Thank you so much for this beautiful theme and your outstanding support from the Press Customizr team!
Sorry, but my expertise in PHP is not as good as in CSS. I do need longer excerpts for my pages (more than 200 chars) on the front page. I added Nicolas’s snippet to my child functions.php. Now I have featured text input boxes on front page. Great!. However, they are still limited to 200 chars. So I also added the snippet from Dave. But the featured text limit stays at 200 chars. I need to increase it. Apparently there is no functional connection between the 2 snippets? Is there an easy way to increase my custom featured text length?
[I hope since this is directly related to your 2 snippets above, I am asking the follow up question in the right place ;-)… ]
Don’t think the 2 snippets are related – one deals with Excerpts yet you’re talking about Featured Text on Front Page.
I’d suggest the Forum would be a better place to get a solution for this, with a much wider audience to help fix problems. And please include a link to your Site.