public function excerpt($wordCount = 20, $delimiter = '...')
    {
        global $post;
        // Store current post into temp variable
        $_p = $post;
        $post = $this->post;
        setup_postdata($post);
        // Do the magic!
        $limit = $wordCount + 1;
        $full_excerpt = get_the_excerpt();
        $full_excerpt_count = count(explode(' ', $full_excerpt)); /* Correct Word Count */
        $new_excerpt = explode(' ', $full_excerpt, $limit);
        if ($full_excerpt_count <= $wordCount) {
            $delimiter = '';
        } else {
            array_pop($new_excerpt);
        }
        $new_excerpt = implode(' ', $new_excerpt) . $delimiter;
        // Restore the post
        $post = $_p;
        if ($_p) {
            setup_postdata($post);
        }
        return $new_excerpt;
    }
public function excerpt($wordCount = 20, $delimiter = '...')
    {
        global $post;
        // Store current post into temp variable
        $_p = $post;
        $post = $this->post;
        setup_postdata($post);
        // Do the magic!
        $limit = $wordCount + 1;
        $full_excerpt = get_the_excerpt();
        $full_excerpt_count = count(explode(' ', $full_excerpt)); /* Correct Word Count */
        $new_excerpt = explode(' ', $full_excerpt, $limit);
        if ($full_excerpt_count <= $wordCount) {
            $delimiter = '';
        } else {
            array_pop($new_excerpt);
        }
        $new_excerpt = implode(' ', $new_excerpt) . $delimiter;
        // Restore the post
        $post = $_p;
        if ($_p) {
            setup_postdata($post);
        }
        return $new_excerpt;
    }
public function excerpt ( $ wordCount = 20 , $ delimiter = '...' ) { global $ post ; // Store current post into temp variable $ _p = $ post ; $ post = $ this -> post ; setup_postdata ( $ post ) ; // Do the magic! $ limit = $ wordCount + 1 ; $ full_excerpt = get_the_excerpt ( ) ; $ full_excerpt_count = count ( explode ( ' ' , $ full_excerpt ) ) ; /* Correct Word Count */ $ new_excerpt = explode ( ' ' , $ full_excerpt , $ limit ) ; if ( $ full_excerpt_count <= $ wordCount ) { $ delimiter = '' ; } else { array_pop ( $ new_excerpt ) ; } $ new_excerpt = implode ( ' ' , $ new_excerpt ) . $ delimiter ; // Restore the post $ post = $ _p ; if ( $ _p ) { setup_postdata ( $ post ) ; } return $ new_excerpt ; }
Retrieve the post's excerpt

Note: Temporarily sets the global $post object to the event post and resets it

@access public
@link http://codex.wordpress.org/Function_Reference/get_the_excerpt
@global WP_Post $post
@param int $wordCount (default: 20)
@param string $delimiter (default: '...')
@return string
Retrieve the post s excerpt