How to Change Wordpress Post Excerpt Length

preview_player
Показать описание
Length of the excerpt can be increased or decreased easily by using a simple PHP function according to your blog need.

Wordpress Post excerpts are used to reduce your blog posts so as to show only the important part such as the introduction or the summary of the blog to the reader. Using WordPress post excerpts is optional, however they play a vital role in seeking attention of a reader towards your blog. The default wordpress excerpt lengths is 55 words. It means that Wordpress will display minimum 55 words or more on the Wordpress Index pages. After learning from this tutorial you will be able to change the value of WordPress excerpt length as of your choice.

Step # 1 --Altering excerpt length

Different blogs have different needs. Therefore, Wordpress allows you to increase or decrease your Wordpress post excerpt length according to your blog's need. A simple PHP function has to be added into the theme's PHP functions file in order to alter the excerpt length.

Step #2: Go to "Editor" Option

First, to alter your Wordpress post excerpt length, you need to sign in your admin panel. After you have successfully logged in, click on the "Editor" option which is located in the appearance tab. The Appearance tab is located at the left side under the Dashboard menu.

Step # 3 -- Choose newly added function

On the "Editor" page, you can see a number of functions listed in a menu. You have to choose the newly added function to alter the excerpt length among all the functions.

Step # 4 -- Change the number according to your blog need

After you have chosen the newly added function, look at the number mentioned in the script which is being returned to the function "new_excerpt_length".This function will decrease your excerpt length to 25 words, however you can change the length 25 in the function to any number to increase or decrease the excerpt length according to your needs.
Рекомендации по теме
Комментарии
Автор

It's extremely important WHERE in the functions section you paste the code -- such as not in the middle of another function! I'm baffled you didn't mention that!

ablestmage
Автор

thank a million for your help, helped me a lot ...

rockomoron
Автор

It;s me again i need a little help please i need to do the same with post title, any suggestion let me know i'll appreciate...thanks again.

rockomoron
Автор

you have to add only this to the .php file:

add_filter('excerpt_length', 'new_excerpt_length');
function new_excerpt_length($len){
return 333;
}

Gagarinprojectofficial
Автор

u missed the most important part to where the code goes.. and was it hard to actually copy the code in the description.. this training does no help sorry

MrTmlife