I am currently using a wordpress plugin called “limit-posts” to better customize my post excerpts. The only issue I have is the excerpt is including the caption text from the image that is within the post.
I can see in the code that all captions are enclosed in tags
Is there a way I can strip out the any content within em tags from the post excerpt?
Here is a link to the current plugin in use – http://labitacora.net/comunBlog/limit-post.phps
Thank you very much
From what I understand the caption is a shortcode, so wrap get_the_content(…) inside
strip_shortcodes()
and it should remove it…I’d not use something like this at all. There are plenty of hooks for content and excerpt retrieval to use, I see absolutely no need to drop native functions in favor of something else.
You can use
excerpt_length
filter to change excerpt length (in words) orthe_excerpt
to make changes to excerpt’s text before output.If I may ask – what is your technical level with WordPress? Do you want some code examples for this? If so please write out how exactly you want excerpt modified.
You can always simply hide it with CSS.
It’s not a perfect solution but may be sufficient for your case.
CSS class of the caption paragraph is
.wp-caption-text