Adjusting length of post excerpt

Hi guys! I was wondering if there was a way to control the length of the excerpt shown under each post on home page.

I want it to be shorter than it is at present. Is there any CSS to limit it by the number of words or lines?

I know you can do it manually, and I’ve done it for some posts. But not only is it extremely time consuming, the excerpt now ends abruptly without the […] that is usually displayed by default. Please help!

My site: http://www.lipstickalchemist.com

Hey there,
I hope you’re doing well today

Here are some options you can use to limit the excerpts

Best Regards,
Support

I just tried to reply to this thread and I got blocked for some reason!

Limiting Excerpt Length To Number of Characters" sounds like the best option. But since I’m changing PHP files I wanna be doubly sure I’m doing it right.

I want to limit excerpt to 200 characters so should I add the entire bit of code provided in that section of the solution (I’m not able to paste it here, the site blocks me out)?

Should I add it all? Where in the php file do I add it? Please advise.

To achieve it you can try adding following code in the functions.php file of your child theme.

function custom_excerpt_length( $length ) {
	return 200;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );

Alternatively you can try using any of the following plugins to achieve it.

Thank you for confirming! I used this and it worked fine, but since words can be of different character lengths, there are inconsistencies in the number of lines the excerpt needs.

I want to restrict it to just two lines. And so, character length would be a better option. So I tried using the solution “Limiting Excerpt Length To Number of Characters” but that doesn’t work for some reason. Any help would be appreciated! :slight_smile:

To limit it by characters please use the solution posted here https://wordpress.stackexchange.com/a/70924/14347

Can you please tell me where I should specify the excerpt length? I’m sorry I don’t know! I pasted the suggested code in functions.php but now it looks like the default excerpt length.

Developing custom code for custom functionality is beyond the scope of support that we provide here.

If you are not a developer then you can consider hiring a developer to develop it for you. You can hire a developer from any freelance site. Colorlib recommends the developer https://www.upwork.com/freelancers/~011652ffec8865c6d5