WordPress.org

Ready to get started?Download WordPress

Forums

Advanced Most Recent Posts Mod
[resolved] Possible to use custom excerpt rather than automatic? (4 posts)

  1. Tessa
    Member
    Posted 3 years ago #

    [Plugin: Advanced Most Recent Posts Mod]

    Hi there,

    This plugin is working great but there's one problem I'm having - the automatically generated excerpts are cutting off in the middle of sentences. I'd like to have it use custom excerpts instead. Can this be done through a code hack, or will I need to use a different plugin?

    Thanks
    Tessa

  2. Kailey (trepmal)
    Volunteer Mod & Reviewer
    Plugin Author

    Posted 3 years ago #

    On line 418/19 of adv-most-recent.php there should be a line like this:

    $excerpt = $separator . ($spot == 'spot3' ? '<span class="date">'.$time.'</span> ' : '') . $excerpt . $afterexcerpt_html;

    Replace that with this:

    if ( ! empty( $post->post_excerpt ) )  {
    	$excerpt = $separator . ($spot == 'spot3' ? '<span class="date">'.$time.'</span> ' : '') . $post->post_excerpt;
    }
    else {
    	$excerpt = $separator . ($spot == 'spot3' ? '<span class="date">'.$time.'</span> ' : '') . $excerpt . $afterexcerpt_html;
    }

    The new code does this: If the custom post excerpt has been set, use that and ignore whatever has been set for the "after excerpt" text (change that if you wish, but the typical '...' wouldn't make sense here). Otherwise, if the custom excerpt hasn't been set, proceed as usual.

  3. Tessa
    Member
    Posted 3 years ago #

    You are amazing! Thank you!

  4. Kailey (trepmal)
    Volunteer Mod & Reviewer
    Plugin Author

    Posted 3 years ago #

    I do my best!

    Glad to help.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic