Support » How-To and Troubleshooting » multiple excerpt lengths without stripping p tags?
5 years 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?
<?php echo excerpt(75); ?>
[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.
4 years, 9 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);
$excerpt = preg_replace('
4 years, 5 months ago