So I limited the amount of characters per post via the_excerpt('50') but it removes the image that I added to my post. How can I bring that image back so it shows up above the post then limits the characters?

2 Answers 2


The problem is that the_excerpt() strips all HTML. There's a good reason for this: what if the 49th word of a 50 word excerpt was the first word of a bulleted list? Or the second word in an <h1>?

The way I would work around this is by using post thumbnails. These allow you to have an image you can choose to display at different sizes (or not at all) depending on the situation. I've often used them as small image queues above excepts which link to a full post. I would then insert a larger version of the image inside the post.

If your theme doesn't currently support post thumbnails, you can activate them by adding:


to your functions.php. You can also add custom image sizes in functions.php like so:

add_image_size('sideFeature', 252, 999, false);

where the arguments are: name, width, height, and crop. Here's the reference. I've made the height "999" here because I only really care about the width being a certain amount. Afterward, you can then call:


inside of your theme to display it when you're in the loop.

If you need more than one thumbnail, you can use something like the Multiple Post Thumbnail plugin. I've used it a few times, and it's worked quite well for me.


Gavin is totally right about the excerpt needing to strip html, but sometimes you really do want to keep some of that html. Then what?

I wrote an excerpter that preserves key html tags. You can find it here: https://wordpress.stackexchange.com/questions/42989/limit-to-a-certain-number-of-characters-in-excerpt-but-keep-html-tags-and-only

And maybe you have some suggestions to make it better?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.