Forums

multiple excerpt lengths without stripping p tags? (3 posts)

  1. 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]

  2. Ipstenu
    Half-Elf Support Rogue & Mod
    Posted 6 months ago #

    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.

  3. 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);

Reply

You must log in to post.

About this Topic