Archived topic
Show HTML in excerpts
5 replies · Started by Mike on June 5, 2019
Is there a preferred way to show HTML tags in excerpts -- I want links in the post content to show up in the archive page excerpts.
Using the Tasty theme, with the archive page displaying featured images, image padding removed. I tried using the More link, but then I get double images, the featured image and the first image in the post. I could turn off featured images, but I can't see how to remove image padding from the regular image.
Thanks!
Hi there,
Using the more tag is the way to go, or you can consider using the excerpt metabox:
https://www.wpbeginner.com/glossary/excerpt/
Not sure why you would need to add the image twice? Wouldn't it work better to show the featured image in single post as well?
https://docs.generatepress.com/article/adjusting-the-featured-images/
Let me know :)
Thanks. Manual excerpts works for now, but less convenient if I have links in every post -- besides having to copy-paste the content, I'd have to edit in two places.
I was thinking of more of a permanent solution, like changing what's stripped out of excerpts as a function. I found various bits of code for that, but many of them were years old, and I wondered if you had a kinda best practices version.
I don't use featured images in posts, in case I change themes and there's no support for featureds in single posts. And in general, it seems safer to have everything self-contained in the post -- for example, in the past, I've had to search and replace in image tags. Is this an unnecessary concern?
Hmm I'm not aware of a way to keep links in excerpt without using one of the two methods above unfortunately.
GP just uses the default WordPress excerpt function though:
https://developer.wordpress.org/reference/functions/the_excerpt/
Maybe check with WordPress support to see if they have any recommendations?
Featured images should be quite well supported as it's a WordPress feature again:
https://codex.wordpress.org/Post_Thumbnails
That would be my recommendation anyways.
Yeah, I guess it's more of a WordPress issue than a GP one. I'll figure it out. Thanks!
No problem :)