Trouble getting your posts page to display only excerpts? You are not the only one. Many WordPress themes don’t actually support the feature – even the bundled and default WordPress themes seem lacking (notably, the Twenty-Thirteen theme that this site uses).
Clicking on a category or index page shows the full posts, and is a trouble to scroll through. This is especially so for long posts.
The cause in my case? Seems like WordPress supports “Only displaying Excerpts for Search” in its Twenty-Thirteen theme, as show in content.php:
.
.
.
<?php if ( is_search() ) : // Only display Excerpts for Search ?>
<div class="entry-summary">
<?php the_excerpt(); ?>
</div><!-- .entry-summary -->
<?php else : ?>
.
.
.
The solution is a simple one-liner luckily. Replacing is_search() with !is_single() checks if the post or page is being displayed on another page, and won’t show the full content unless it is being viewed directly:
.
.
.
<?php if ( !is_single() ) : // Only display Excerpts, except When Viewing Post>
<div class="entry-summary">
<?php the_excerpt(); ?>
</div><!-- .entry-summary -->
<?php else : ?>
.
.
.
WordPress needs to vet their themes a bit better! This fix works as required, and I get a nice excerpt on all my category and index pages:
Now I have happy excerpts, and to you I wish Happy WordPress-ing!