I’m attempting to shorten my
the_content() phrase rely to 200 whereas retaining the html formatting in addition to the shortcodes. I’m fairly shut however for some purpose, I can’t get power steadiness tags or balanceTags() to work as supposed.
The code I’m utilizing is the next
$content material = html_entity_decode(wp_trim_words(htmlentities(get_the_content()), 200)); echo force_balance_tags(do_shortcode($content material));
If I break the content material at 300, its high-quality, however that’s solely as a result of it doesnt reduce at an html tag. particularly at 200 it’s slicing at
goal="_blank" and never closing the
a tag. When i run the steadiness tags features, it seemingly does nothing.
How do I get the content material, be certain that it retains the formatting and quick codes, AND balances the tags no matter the place I finish it.