Support » How-To and Troubleshooting » get_post post_excerpt not displaying

get_post post_excerpt not displaying

  • I am using get_post() to display an array of post ids.

    I am using it properly. I can get

    $title = $post_id->post_title;
    echo $title;

    to display the title of the post.

    However, when I try

    $excerpt = $post_id->post_excerpt;
    echo $excerpt;

    nothing is displayed. There is content in the post, and I can display when I use post_content. But I want the excerpt because I want to filter out the images in the post.

    Any advice?

Viewing 3 replies - 1 through 3 (of 3 total)
  • <?php
    //display all post titles, and if an excerpt exists, show it
    if ($posts) {
      foreach($posts as $post) {
        <p><?php the_time('m.d.y') ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
        if ($post->post_excerpt) {
          echo 'excerpt is:' . $post->post_excerpt;

    Note that echo $post->post_excerpt; would also work

    I forgot to say… thanks for the reply! I ended up doing something totally different because of a last minute design change. But this was helpful to see.

    I am also using get_post() to display a single page

    $pagina = & get_post( $dummy_id = 6 );?>
    <h2><?php echo $pagina->post_title;?></h2>
    <?php echo $pagina->post_content; ?>

    However, if i want to show only the text before my page break…. how i do?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘get_post post_excerpt not displaying’ is closed to new replies.