The following are four ways to display article summaries in WordPress:
1. Use WordPress’s own summary function
I currently use this method on another WordPress blog, and the display effect is also very satisfactory. The only drawback is that I need to set a separate summary when writing an article. However, this point must be viewed dialectically. Although it is a bit troublesome, it has good flexibility.
Usage setting method:
1. Click "Show Options" in the upper right corner of the article editing page, check the "Abstract" option inside, and write the summary content separately when writing articles in the future. Can.
2. After the article is published, you may see that the full text is still output on the home page, while the summary is displayed on the archive pages such as categories and tags. We can use the following methods to solve the problem.
3. In the WordPress backend "Appearance" - "Edit", click to modify the loop.php file, about line 137, find and modify the following sentence, add a home page applicable judgment, the red font is Add section.
<?php if ( is_archive() || is_search() || is_home() ) : // Only display excerpts for archives and search. ?>
4. After setting, the home page will be displayed in summary like other archive pages.
Related recommendations: "WordPress Tutorial"
2. Insert the "more" separation tag
1. This is also a setting that comes with WordPress One of the summary methods is to insert the "more" separation tag after the intercepted summary text when editing the article, click the "more" separation icon in the editor above, or you can directly write the label statement "".
2. After setting, the homepage and other archive pages will be displayed like a summary, and a "Continue Reading →" link will be automatically added after the summary. However, if you look closely at this link, you may find that #more-id is added at the end. It is a content jump anchor link. Clicking it will go to the summary content to continue reading.
3. Whether to remove this anchor point jump depends on personal preference. If you want to remove it, in the WordPress backend "Appearance" - "Edit", click to modify the functions.php file, copy and add the following code. The meaning of the code is to use the filter of WordPress the_content_more_link, and use it with a regular expression to replace the string in the form of #more-id in the link with nothing.
The code is as follows:
function remove_more_jump_link($link) { return preg_replace('/#more-\d+/i','',$link); } add_filter('the_content_more_link', 'remove_more_jump_link');
3. Modify the theme index.php file
1. Open the folder where you are using the theme, find the index.php file, and find the following code :
<?php the_content(__(’(more…)’)); ?>或者<?php the_content(); ?>
2. Modify it to:
The code is as follows:
<?php if(!is_single()) { the_excerpt(); } else { the_content(__(’(more…)’));//或者<?php the_content(); ?> } ?>
3. After saving, the article can automatically intercept the abstract, but the disadvantage is that the format in the abstract will Disappear, such as bold text, font color, etc.
4. Use summary plug-ins
Although there are some aspects of WordPress that are not suitable for our use, fortunately, there are many plug-ins, and there are many plug-ins that automatically set article abstracts. Here are a few that are easier to use. of.
1. WP-UTF8-Excerpt: supports multi-byte languages (such as Chinese), will not produce garbled characters and retains the format.
2. WP-Posts Auto Cutter: UTF-8 interception method is used to prevent Chinese garbled characters and retain the summary format. The author of this plug-in has not submitted it to WordPress. You can only download it from the author's homepage: http://blog.netdll.com/?p=1276 (the website is blocked).
3. Limit Posts Automatically: Mainly used for English sites, and errors will occur if used in Chinese
The above is the detailed content of How to set up WordPress post excerpts. For more information, please follow other related articles on the PHP Chinese website!

Can learn WordPress within three days. 1. Master basic knowledge, such as themes, plug-ins, etc. 2. Understand the core functions, including installation and working principles. 3. Learn basic and advanced usage through examples. 4. Understand debugging techniques and performance optimization suggestions.

WordPress is a Content Management System (CMS). It provides content management, user management, themes and plug-in capabilities to support the creation and management of website content. Its working principle includes database management, template systems and plug-in architecture, suitable for a variety of needs from blogs to corporate websites.

WordPressisgoodforvirtuallyanywebprojectduetoitsversatilityasaCMS.Itexcelsin:1)user-friendliness,allowingeasywebsitesetup;2)flexibilityandcustomizationwithnumerousthemesandplugins;3)SEOoptimization;and4)strongcommunitysupport,thoughusersmustmanageper

Wix is suitable for users who have no programming experience, and WordPress is suitable for users who want more control and expansion capabilities. 1) Wix provides drag-and-drop editors and rich templates, making it easy to quickly build a website. 2) As an open source CMS, WordPress has a huge community and plug-in ecosystem, supporting in-depth customization and expansion.

WordPress itself is free, but it costs extra to use: 1. WordPress.com offers a package ranging from free to paid, with prices ranging from a few dollars per month to dozens of dollars; 2. WordPress.org requires purchasing a domain name (10-20 US dollars per year) and hosting services (5-50 US dollars per month); 3. Most plug-ins and themes are free, and the paid price ranges from tens to hundreds of dollars; by choosing the right hosting service, using plug-ins and themes reasonably, and regularly maintaining and optimizing, the cost of WordPress can be effectively controlled and optimized.

The core version of WordPress is free, but other fees may be incurred during use. 1. Domain names and hosting services require payment. 2. Advanced themes and plug-ins may be charged. 3. Professional services and advanced features may be charged.

WordPress is easy for beginners to get started. 1. After logging into the background, the user interface is intuitive and the simple dashboard provides all the necessary function links. 2. Basic operations include creating and editing content. The WYSIWYG editor simplifies content creation. 3. Beginners can expand website functions through plug-ins and themes, and the learning curve exists but can be mastered through practice.

People choose to use WordPress because of its power and flexibility. 1) WordPress is an open source CMS with strong ease of use and scalability, suitable for various website needs. 2) It has rich themes and plugins, a huge ecosystem and strong community support. 3) The working principle of WordPress is based on themes, plug-ins and core functions, and uses PHP and MySQL to process data, and supports performance optimization.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.