If "optional excerpt" has typed something, show the_excerpt. (don't show the_content()), otherwise show the_content();
Is that doable?
If "optional excerpt" has typed something, show the_excerpt. (don't show the_content()), otherwise show the_content();
Is that doable?
<?php
if( $post->post_excerpt ) {
the_excerpt();
} else {
the_content();
}
?>Thanks Kafkaesqui ... that helped me with another issue. I wanted to use the permalink only if a post actually contained content ... otherwise just write the title.
<ul>
<?php global $post;
$myposts = get_posts('numberposts=20&'."category=$category->id");
foreach($myposts as $post) : setup_postdata($post);
if( $post->post_content ) { ?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> <span class="datetime">(<?php the_time('j. F Y'); ?>)</span></li>
<?php } else { ?>
<li><?php the_title(); ?> <span class="datetime">(<?php the_time('j. F Y'); ?>)</span></li>
<?php } ?>
<?php endforeach; ?>
</ul>
I'm posting it here just in case someone else is looking for something similar.
This topic has been closed to new replies.