How to let WordPress only displays summary of article on home page

Firstly, find the directory: Appearance -> Theme Editor -> Main Index Template -> index.php, and locate the code:

/* Start the Loop */
while ( have_posts() ) :
    the_post();

    /*
     * Include the Post-Format-specific template for the content.
     * If you want to override this in a child theme, then include a file
     * called content-___.php (where ___ is the Post Format name) and that will be used instead.
     */
    get_template_part( 'template-parts/post/content', get_post_format() );

Secondly, follow the directory template-parts/post/content to find content.php and open it, locate the code:

the_content(
    sprintf(
        __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentyseventeen' ),
        get_the_title()
    )
);

Replace the above code to:

 if(!is_single()) {
    the_excerpt();
    } else {
    the_content(__('(moreā€¦)'));
 }  

Lastly, save the changes and have a look at your new home page!

Leave a Reply