Q:

get post excerpt in WordPress

I am trying to get this wordpress page template to display an excerpt from a specific post. When the post was created I was sure to insert the  link in the place that I want. I am able to grab the title, the thumbnail, the permalink, etc... but for whatever reason I can not get the excerpt. I have tried:
the_excerpt();
get_the_excerpt();
the_content('',FALSE);
get_the_content('', FALSE, '');
get_the_content('', TRUE);

Among other things. When I try get_the_content('', TRUE) it gives me the content from everything AFTER the  link but I want what is BEFORE the link.
Any ideas?
   <?php
        $query = 'cat=23&posts_per_page=1';
        $queryObject = new WP_Query($query);
    ?>

    <?php if($queryObject->have_posts()) : ?>

        <div>

            <?php while($queryObject->have_posts()) : $queryObject->the_post() ?>

                <div>

                    <h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>

                    <br>

                    <?php the_post_thumbnail() ?>

                    <?php #the_excerpt(); ?>

                    <div>

                        <a href="<?php the_permalink(); ?>">Read More</a>

                    </div>

                </div>

            <?php endwhile ?>

        </div>

    <?php endif; wp_reset_query();

?>

A:

Try adding this to your functions.php and calling the excerpt by post ID:
//get excerpt by id
function get_excerpt_by_id($post_id){
    $the_post = get_post($post_id); //Gets post ID
    $the_excerpt = ($the_post ? $the_post->post_content : null); //Gets post_content to be used as a basis for the excerpt
    $excerpt_length = 35; //Sets excerpt length by word count
    $the_excerpt = strip_tags(strip_shortcodes($the_excerpt)); //Strips tags and images
    $words = explode(' ', $the_excerpt, $excerpt_length + 1);

    if(count($words) > $excerpt_length) :
        array_pop($words);
        array_push($words, '…');
        $the_excerpt = implode(' ', $words);
    endif;

    return $the_excerpt;
}

Then call it in your template like this:
get_excerpt_by_id($post->ID);

A:

Here's a pretty neat solution that'll do the trick for you!
    <div class="post">
      <h3 class="title"><?php echo $post->post_title ?></h3>
      <?
        // Making an excerpt of the blog post content
        $excerpt = strip_tags($post->post_content);
        if (strlen($excerpt) > 100) {
          $excerpt = substr($excerpt, 0, 100);
          $excerpt = substr($excerpt, 0, strrpos($excerpt, ' '));
          $excerpt .= '...';
        }
      ?>
      <p class="excerpt"><?php echo $excerpt ?></p>
      <a class="more-link" href="<?php echo get_post_permalink($post->ID); ?>">Read more</a>
    </div>

