Forums

Excerpt length outside the loop (3 posts)

  1. TootsieRoll
    Member
    Posted 5 months ago #

    I am using a loop to display posts from one specific category (10) displaying the post's thumbnail, it's title, and an excerpt from it.
    I am using the manual excerpt outside of the loop, and it works, except I would like to set a max amount of words so that each post preview looks the same.

    I can't figure out how to set a word limit on the manual excerpt since it's outside of The Loop.

    Thanks for your help!

    [Code moderated as per the Forum Rules. Please use the pastebin]

  2. alchymyth
    The Sweeper
    Posted 5 months ago #

    you might get some ideas from this article http://www.transformationpowertools.com/wordpress/automatically-shorten-manual-excerpt

    (check how much the original code of 'wp_trim_excerpt()' has changed since I posted that article, in /wp-includes/formatting.php from line 1879, and adjust the code accordingly)

  3. jhkb
    Member
    Posted 4 months ago #

    Thanks for the link to your article, looks good, but is there anyway to show an auto-generated excerpt (then shortened) on the homepage?

    I also added a similar comment to your article, but thought someone here might also know if it's possible.

    Thanks
    Jess

Reply

You must log in to post.

About this Topic