What's the best way to trim content from WYSIWYG editor?
I have done an excessive amount of googling and haven't found exactly what I need yet.
The client uses the editor (WYSIWYG) to create posts. She adds photos, links to external photos, videos, embeds external videos, and all other formatting. But she does not use the tag nor the excerpt field.
When I use wp_trim_words()
I get mixed results.
- Posts with local videos leak markup onto the page
- A couple posts are only images so there isn't any content at all
- Posts with a lot of formatting look really wonky
Anyone have any other ideas on how to trim content or better ways to use wp_trim_words() ?
EDIT: To make myself clear basically what I want is a trimmed version of the full post that still contains all the formatting, images, videos, links, embeds, whatever else she throws into the editor. I do not want markup leaking through, obviously.
Topic editor formatting wysiwyg Wordpress
Category Web