• Resolved dtomasch

    (@dtomasch)


    I’m using the php function:

    the_advanced_excerpt(‘length=75&length_type=words&finish=sentence&no_custom=0&allowed_tags=p’); ?>

    The auto-generated excerpt is formatted the way I want it.

    But posts with a custom except aren’t formatted with a p-tag.

    So I’m either wapping the_advanced_excerpt in a p tag (and end up with an extra, empty <p>) or my manual excerpts don’t look right.

    Any thoughts?

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author WPKube

    (@wpkube)

    Hi @dtomasch

    Keep in mind that WordPress doesn’t automatically automatically apply paragraphs to the custom excerpts like it does with the regular content. So you would need to specifically add paragraphs:

    <p>Paragraph one</p>
    <p>Paragraph two</p>

    If you do have it like that but it’s not working, let me know and we’ll figure it out. The test I did on my local install worked fine.

    Thread Starter dtomasch

    (@dtomasch)

    Oh yes of course I had forgotten about that.

    If I modify the_excerpt() (as an example https://www.aaronrussell.co.uk/legacy/improving-wordpress-the_excerpt/)

    Will AE honor that?

    Plugin Author WPKube

    (@wpkube)

    Hi @dtomasch

    I’d suggest a different approach.

    echo wpautop( the_advanced_excerpt('length=75&length_type=words&finish=sentence&no_custom=0&allowed_tags=p', true) );

    the_advanced_excerpt has a 2nd parameter, when set to true it’s a return instead of echo, so you can “work with” the excerpt before displaying it.

    Wrapping it in wpautop automatically applies paragraphs to new lines.

    Thread Starter dtomasch

    (@dtomasch)

    That’s great! Thanks. Cheers!

    Plugin Author WPKube

    (@wpkube)

    You’re welcome.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Manual Excerpts — no p tags?’ is closed to new replies.