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?
<?php
//display all post titles, and if an excerpt exists, show it
$posts=get_posts('post_type=post&showposts=-1');
if ($posts) {
foreach($posts as $post) {
setup_postdata($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>
<?php
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
<?php
$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?