The homepage by default uses the index.php
template, and in that file, the posts
are displayed like this:
// Load posts loop.
while ( have_posts() ) {
the_post();
get_template_part( 'template-parts/content/content' );
}
And in template-parts/content/content.php
, you'd see the following:
the_content(
sprintf(
wp_kses(
/* translators: %s: Name of current post. Only visible to screen readers */
__( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentynineteen' ),
array(
'span' => array(
'class' => array(),
),
)
),
get_the_title()
)
);
And that displays the full post content.
If you want to show just the post excerpt, change the above code to this:
if ( is_singular() ) {
the_content(
sprintf(
wp_kses(
/* translators: %s: Name of current post. Only visible to screen readers */
__( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentynineteen' ),
array(
'span' => array(
'class' => array(),
),
)
),
get_the_title()
)
);
} else {
the_excerpt();
}
That should work, but you might want to create a child theme so that your modification wouldn't be wiped when you update Twenty Nineteen.
Hi, I just checked the directory /wp-content/themes/twentyseventeen/template-part/post/ but don't see a file called content.php. Is there a way to reinstall this theme if the file is missing for whatever reason?