admin管理员组文章数量:1287517
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?
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?
Share Improve this question asked Sep 17, 2021 at 16:52 nevnev 1011 bronze badge1 Answer
Reset to default 0I 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.
本文标签: theme twenty seventeenHow to enable excerpts just on the quotPosts pagequot
版权声明:本文标题:theme twenty seventeen - How to enable excerpts just on the "Posts page" 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741314083a2371814.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论