WordPress Display article Summary of the method

Source: Internet
Author: User
Tags wordpress blog
This article mainly introduces the WordPress display Article summary method, has a certain reference value, now share to everyone, the need for friends can refer to

WordPress is a relatively bad place, home page, classification and other archive pages, the article default is the full-text output arrangement. I do not know whether foreign bloggers are popular this way of display, I personally do not like it. When the article is long and carries a lot of pictures, not only is the page speed open slowly, it is also not easy to find the content of interest quickly. According to the majority of domestic users

Here are four kinds of WordPress display Article Summary method:

First, using WordPress to bring the summary function

I currently another WordPress blog is the use of this method, the display effect is also very satisfied, the only problem is to write the article should be set separately summary. But it is also a dialectical point of view, although it is a bit troublesome, but good flexibility.

Use the Setup method:

1, click "Show Options" in the upper right corner of the article editing page, check the "Summary" option, and then write the summary content in the article.

2, the article after the release you may see in the first page or the full text output, but in the classification, labels and other archive pages are summary display, we can use the following methods to solve.

3, in the WordPress background "appearance"--"edit", click Modify loop.php file, about 137 lines around, find and modify the following sentence, add a home page to apply judgment, red font for the added part.

<?php if (is_archive () | | is_search () | | is_home ())://Only display excerpts for archives and search. ?>

4, set the first page as the other Archive page summary display.

Second, insert "more" separator label

1, this is also one of WordPress's own set of summary methods, just in the article editing, after intercepting the summary text, insert "More" Separator tab, click the above editor "more" separator icon, or you can directly write the label statement "<!--more-->".

2, set up in the homepage and other archive page similar to the summary shown, after the summary will automatically add a "Continue reading →" link. But this link is a closer look you may find that after adding #more-id, it is a content Jump anchor link, click will go to the section of the summary after the content to continue reading.

3, do not want to remove this anchor point jump to see a person's preferences. If you want to remove, in the WordPress background "appearance"--"edit", click Modify functions.php file, copy add the following code. The code meaning is to use the WordPress the_content_more_link filter filtering, and through it plus the regular expression, the link in the form of #more-id string replaced by empty.

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 ');

Third, modify the theme index.php file

1. Open the folder where you are using the theme, locate the index.php file, and locate the following code:

<?php the_content (__ (more ...)); ?> or <?php the_content ();?>

2. Modify it to:

The code is as follows:

<?php if (!is_single ()) {the_excerpt ();} else {the_content (' (More ...) '); /or <?php the_content ();?;}?>

3, after saving the article can automatically intercept the summary, but the drawback is that the summary of the format will disappear, such as text bold, font color and so on.

Iv. using the Summary plugin

WordPress Although some places do not meet our use, but fortunately the plugin rich, automatically set up the article summary of the plug-ins are also many, the following introduction of several more useful.
1, Wp-utf8-excerpt: Support multi-byte language (such as Chinese), will not produce garbled and preserve the format.
2, wp-posts Auto Cutter: Use UTF-8 mode interception, will not be garbled in Chinese and retain the digest format. This plugin author does not submit to WordPress, download can only go to author homepage: http://blog.netdll.com/?p=1276 (URL is wall).
3, Limit Posts automatically: mainly used in English stations, Chinese use will produce errors.

The above is the whole content of this article, I hope that everyone's learning has helped, more relevant content please pay attention to topic.alibabacloud.com!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.