How to trim content AND retain HTML?

I have an element that use to pull in the_excerpt but we wanted to retain the HTML. So we started using the_content. Now the amount it’s pulling in is too long. I have tried using wp_trim_words but that strips the HTML, essentially making it the same as using the_excerpt.

Is there anyway to limit the amount of content displayed from a page and retain the HTML for just this one instance? I do not want to effect the_excerpt or the_content permanently/site-wide.

Read more here: How to trim content AND retain HTML?

Leave a Reply

Your email address will not be published. Required fields are marked *