Decide about the_excerpt()
or the_content()
with a conditional: is_singular()
.
You can use a plugin and filter the_content
depending on the current page’s type: archive or singular. But you can use it in your theme too.
add_filter( 'the_content', 't5_replace_content_with_excerpt', 100 );
/**
* Return excerpt if we are not on a singular post view.
*
* @param string $content
* @return string
*/
function t5_replace_content_with_excerpt( $content )
{
if ( is_singular() )
{
return $content;
}
// remove our filter temporarily.
// Otherwise we run into a infinite loop in wp_trim_excerpt().
remove_filter( 'the_content', __FUNCTION__, 100 );
$excerpt = apply_filters( 'the_excerpt', get_the_excerpt() );
add_filter( 'the_content', __FUNCTION__, 100 );
return $excerpt;
}
In your theme find the line where you are calling the_content()
. Change it to:
is_singular() ? the_content() : the_excerpt();