最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

themes - How do I make it so that WordPress displays the post as a heading, followed by a written excerpt?

programmeradmin1浏览0评论

I'm not sure if this is default behaviour, at least for the theme I am using, but when I go to my blog, all of the posts just stream down the page.

So, how do I make it so that when I scroll through it, only the title of the post, as well as an excerpt, if one is provided, will show up? In the case that an excerpt is not available, is it possible to set something up to display the first X% of a post, either for that particular post or for all posts?

I'm not sure if this is default behaviour, at least for the theme I am using, but when I go to my blog, all of the posts just stream down the page.

So, how do I make it so that when I scroll through it, only the title of the post, as well as an excerpt, if one is provided, will show up? In the case that an excerpt is not available, is it possible to set something up to display the first X% of a post, either for that particular post or for all posts?

Share Improve this question asked Jul 1, 2019 at 4:33 The Harmonic RainbowThe Harmonic Rainbow 1195 bronze badges 4
  • Where do I put this line of code you posted in the previous line? I went to /blog/wp-content/themes/twentyseventeen and saw a bunch of files and some folders, one of which is called TemplateParts. – The Harmonic Rainbow Commented Jul 1, 2019 at 12:05
  • Please just ignore that comment and try this. – Sally CJ Commented Jul 1, 2019 at 14:34
  • I was able to get it to work, although the child theme was missing a template and index file. Anyhow, I discovered that I had a Twenty-nineteen theme, so I upgraded to that. The directories and PHP files are a lot different, so I couldn't paste the code in your MD file in this one. This post from WordPress Forum didn't help much. – The Harmonic Rainbow Commented Jul 1, 2019 at 18:25
  • In Twenty Nineteen, the template part is located in template-parts/content/content.php. Check the updated gist. – Sally CJ Commented Jul 1, 2019 at 23:19
Add a comment  | 

1 Answer 1

Reset to default 0

Simple setting: look at Admin, Settings, Reading. Change the "Blog pages show at most" value (count).

Then look at your Theme Customizations for a setting to show full posts or excerpts. If you don't put a manual excerpt on the post editing page, then the theme will grab the first xx words (depending on the settings in Theme Customizations). Most themes have a way to specify excerpts or full posts on the home page.

发布评论

评论列表(0)

  1. 暂无评论