Home> CMS Tutorial> WordPress> body text

How to stop WordPress from displaying article excerpts

爱喝马黛茶的安东尼
Release: 2019-07-18 11:20:49
Original
4193 people have browsed it

How to stop WordPress from displaying article excerpts

WordPress summary display method

WordPress has a summary display column in the background. If it is not displayed, it needs to be set. As shown in the figure:

How to stop WordPress from displaying article excerpts

#When the content is displayed on the list page, the summary is usually displayed if there is a summary, and the first part of the text of the article is intercepted if there is no summary. The code is as follows:

post_content),0,400,'......[阅读全文]');?>
Copy after login

The "400" in the code refers to the display characters, two characters are equal to one Chinese character.

Related recommendations: "WordPress Tutorial"

Sometimes, the summary is too long and does not look good when displayed. You can add this paragraph to the functions.php file. Code to control the number of words displayed in the summary.

*控制摘要字数*/ function new_excerpt_length($length) { return 150; } add_filter("excerpt_length", "new_excerpt_length");
Copy after login

The default ending of the summary is [...], which is not in line with the reading habits of Chinese people. You can customize the ending of the summary and insert this code in functions.php

function new_excerpt_more($more) { global $post; return " ID) . "">阅读更多"; } add_filter("excerpt_more", "new_excerpt_more");
Copy after login

Add a read more link at the end of the article summary, which looks more in line with the user's reading habits. Read more can be changed to the content you want.

Summary: If you want to hide the article summary, cancel the "Abstract" in the display item in the background.

The above is the detailed content of How to stop WordPress from displaying article excerpts. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!