How to return the_excerpt (without echo)?

Sure thing my friend, you see, the function “the_excerpt” (located at “WORDPRESSINSTALLDIR/wp-includes/post-template.php”) is the one that makes the echo:

function the_excerpt() {  
    echo apply_filters('the_excerpt', get_the_excerpt());  
}  

so, what you want is to use the same function “apply_filters” without the echo:

$myexcerpt = apply_filters('the_excerpt', get_the_excerpt());

…and there you have your excerpt.

Leave a Comment

error code: 523