How to enable excerpts just on the "Posts page"

In my fresh WordPress installation I'm using a barebones child theme based on the twentyseventeen theme.

In Settings Reading, Your homepage displays is set to the radio button A static page, and I've duly selected a page for the Homepage and another page for the Posts page.

The thing is, I'd like the second, the Posts page, to show just excerpts, with the truncated text and the continue reading link to the actual post (as opposed to the full text of the post, which it's showing now), but I can't work out how to do it.

I get the impression that on some PHP script/page, to be duplicated and modified somewhere in my child theme, the_content should be changed to the_excerpt.

I don't know if that's right (maybe it's a bit more complicated), but even if it is right, I don't know which PHP script/page to look for.

Perhaps it may be relevant to say I'm using the classic editor (plugin).

Can anyone help?

Topic theme-twenty-seventeen excerpt Wordpress

Category Web


I get the impression that on some PHP script/page, to be duplicated and modified somewhere in my child theme, the_content should be changed to the_excerpt.

This is correct.

You can refer to the Template Hierarchy to determine which template file your parent theme is using for the Posts page. Then you can copy that to your child theme and make the necessary function change there.

An issue you might run into is that the_content() might actually be being used in a template partial that's included by get_template_part(), rather than the main template directly. If that's the case then you can use the path passed to that function to find that template partial. Then you just need to copy that template into the child theme, in the sub subdirectories, and modify it there.

Another issue you might have is if there is a template partial, it might also be used for the full single post view. In that case you will need to copy both the main template, and the template partial, and then rename the template partial and change the reference to it in the main template file. That way you have a separate partial just for the posts page.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.