flint_and_tinder
Member
Posted 6 months ago #
I've been using the following code to manually control the excerpt length. However when calling the excerpt using <?php echo excerpt(75); ?> any line breaks in the original excerpt get stripped out. Is there a way I can fix it so they are retained?
[Code moderated as per the Forum Rules. Please use the pastebin]
Calling the excerpt strips out all formatting totally, not just the paragraph tag.
If you use the custom excerpt box, it'll keep all your HTML intact.
flint_and_tinder
Member
Posted 2 months ago #
I don't want to use the custom excerpt box though. I would like it to grab the content. Can I change something in here to bring the tags back in?
$excerpt = preg_replace('\[[^\]]*\]','',$excerpt);