WordPress.org

Support

the_excerpt()

  • unknownserv
    Member

    @unknownserv

    Is there anyway to beable to echo the_excerpt()? eg. instead of just putting the_excerpt() in the code, i’d put echo the_excerpt().

    Thanks

Viewing 1 replies (of 1 total)
  • Of course there is. It’s get_the_excerpt()

    All the template tags use some such method to take care of the ‘echoing’ for you.

    See here from template-functions-post.php:
    function the_excerpt() {
    echo apply_filters('the_excerpt', get_the_excerpt());
    }

    function get_the_excerpt($fakeit = true) {
    global $id, $post;
    $output = '';
    $output = $post->post_excerpt;
    if ( !empty($post->post_password) ) { // if there's a password
    if ( $_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password ) { // and it doesn't match the cookie
    $output = __('There is no excerpt because this is a protected post.');
    return $output;
    }
    }

    return apply_filters('get_the_excerpt', $output);
    }

Viewing 1 replies (of 1 total)
  • The topic ‘the_excerpt()’ is closed to new replies.