Home >CMS Tutorial >WordPress >How to make wordpress only display the first 3 lines of an article
#In WordPress, you can use the more tag to display only the first three lines of an article. As long as you insert the more tag after the third line, you can realize that only the first three lines of the article will be displayed when the web page is displayed. Three lines.
I believe that friends who have been in contact with WordPress are familiar with the "more" tag. When the mouse slides to the toolbar as shown below in the edit box, there will be an "Insert more tag" hint. But will you use it? It is estimated that many of my friends have never encountered this label.
The role of the more tag:
In fact, the more tag can be used to control the display of the article summary content. When the content of all articles is displayed as a single article (read the full text), when the content of non-single articles (categories, tags, article lists, etc.) is displayed as the content above the more tag (abstract), the user clicks on the article title to enter. Read the full text. In this way, you can also control the style of the article list, making the article list more neat and beautiful. As shown in the figure below:
Usage method:
Method 1:
In the visual interface of the wordpress article editor, click Just click the "Insert more tag" icon as shown in the picture when setting the summary. (If you use a third-party editor, the icon may be different, but the operation method is the same)
Method 2: Implementation through code
In fact, method 1 is also through code What is achieved is just a visual operation. Click the text next to the editor (or other HTML code editing mode) to see that the following code is inserted into the source code.
<!--more-->
When we read the content of articles on some websites, we must have discovered that there are words such as "Read the full text" and "View more" next to the abstract, and also style it. settings, such as displaying in picture form, etc. This requires an in-depth understanding of the more tag, as well as html and css code, which is also very simple. Here I will talk about some basic functions and usages. For detailed information, there are many related resources on the Internet, which can be searched and consulted.
For more wordpress related technical articles, please visit the wordpress tutorial column to learn!
The above is the detailed content of How to make wordpress only display the first 3 lines of an article. For more information, please follow other related articles on the PHP Chinese website!