Wordpress more Label Guide

Wordpress articles are displayed in full text in the form of non single article browsing. If the more tag is inserted in a Wordpress article, the WordPress article will only be displayed to the more tag truncation, and then the "read more" and "continue reading" links will be displayed. Click the link to enter a single WordPress article to read, and the full text will be displayed.

Customize more label text one by one

Here are two good ways to define your more link text. The simplest one is to add custom text content when inserting the more tag into the article content. For example, if you need to change the default more to "know more", you can use the

 more--> Replace the label with: Learn more -->

With this method, you can set unique text content for the more tag of any article in WordPress. This is a very popular place in WordPress,

The second is realized through the functions.php file. Theme authors like to control the more tag in the functions.php file, such as:

  function  my_more_link ($more_link, $more_link_text)  { return str_replace($more_link_text, 'Read More' , $more_link); } add_filter( 'the_content_more_link' , 'my_more_link' , ten , two );

The "Read More" can be replaced by the text you think of, such as reading the full text

Third: through theme template file

But some friends found that their functions. php file did not contain this code, so what should we do? In fact, the theme of the blogger is not in this file, because the theme author directly wrote more in the template file, and checked the index file, archive file There will be multiple customized files in the category file and some topics. For example, the blogger needs to modify and replace the Read More file when looking for the_content. Note that these files need to be replaced one by one.

In fact, if there is a fourth and a fifth, there are still some similar ones. As long as you look carefully, you will find them,

In addition, if you find it troublesome to manually add more tags, you can automatically obtain any number of characters as a summary by setting this method. This method is the same as the third method to find that the topic contains the_content code,

For example, it is modified as:

 <!--? php echo mb_strimwidth(strip_tags(apply_filters(‘the_content’, $post-&gt; post_content)), 0, 200,”……”); ?-->

Wherein, 200 means obtaining the first 200 characters

Related links:

Modify the more tag to display the full text in Chinese: https://ranlingqi.com/more.html
Wordpress more Label Complete Guide: https://www.douban.com/note/521768651/ (Recommended)
course

Harmony is polluted by DNS Use Nginx reverse proxy to mirror HTTP (S) websites to solve the problem that websites are polluted by walls and DNS harmoniously

2018-7-13 12:53:19

course

How to prevent whitespace in WordPress user name- WordPress Tutorial

2018-7-13 18:30:02

⚠️
Some codes and tutorials on Npcink come from the Internet, and are only for netizens to learn and exchange. If you like this article, you can Attach original link Reprint at will.
No intention of infringing your rights, please send an email to 1355471563#qq.com Or click on the right Private message: Muze feedback, we will deal with it as soon as possible.
0 replies A Author M administrators
    There is no discussion yet. Tell me your opinion
Personal Center
Shopping Cart
Coupon
Sign in today
There are new private messages Private Message List
search