HostingKiller

What is WordPress excerpt length?

What is WordPress excerpt length?


WordPress excerpt length is like its call name. It is part of the post that links to the full article. It is used to attract readers and make them want to read more. It helps to highlight the main points of the content because sometimes the title is not enough to capture the attention of the viewer.

By default, WordPress limits the excerpt to the first 55 words of a post.

When using the classic WordPress editor, excerpts can be automatically added to content by pressing the Read More button. will add to HTML, and you can see it in the HTML editor. You can also enter a custom message like ..

Also, you can change the snippet length as you like. Increasing the length of the text can draw the reader’s attention to the article.

There are different ways to change the snippet length, I’ll guide you right here.

How to change the snippet length? The two most common ways to change WordPress excerpt length are manually or by using a WordPress plugin.

Changing WordPress Snippet Length Manually The manual method will involve modifying the code. However, you don’t need to have a deep understanding of programming languages ​​to do this.

Here are the steps by which you can change the chunk length yourself:

Hover over the Appearance tab and select Theme Editor.

Open the functions.php file and insert the code:

Code:

function my_excerpt_length($length){ return 80; } add_filter(‘excerpt_length’, ‘my_excerpt_length’);

Change the word limit from 80 to whatever number you like and hit the Update File button.

For some themes, like Twenty Sixteen WordPress, you only need to edit the content.php file. Follow the instructions below:

While still in the Theme Editor, scroll down to the template parts. Under this heading, click on the content.php file.

Code:

Add the following code just below them:

Code:

if ( is_home() || is_category()||is_archive()){ the_excerpt(”); }the rest{

Find the sentences:

Code:

?>

Then insert the following line above them:

Code:

} // end of if statements

Click Update File

and done!

I hope that helps!



Source link

Leave a Comment

Your email address will not be published. Required fields are marked *