WP - Change excerpt length in Wordpress
There is more than one way to change the excerpt length in a Wordpress Post.
I collected all the working methods to change the default excerpt (55) to however you need.

Solution 1 - Excerpt length in “wp-includes”
PROS: Fast and easy.
CONS: This will be applied to every category and archive, incluiding the blog homepage.
Source: It’s Called Web Design
Go into “wp-includes/formatting.php”, line 1333 (line 853 for version prior to 2.7).
Change “55″ according to your needs.
Solution 2 - Excerpt length using Filters in “functions.php”
PROS: You can freely change the excerpt length in each category, archive or in your blog homepage.
CONS: A basic skill in WP and PHP is required.
Source: Wordpress Codex
STEP 1. You can change the excerpt length using excerpt_length filter. Just add the following code into the “wp-content/themes/THEME_NAME/functions.php” file:
<?php
function new_excerpt_length($length) {
return 20;
}
add_filter('excerpt_length', 'new_excerpt_length');
?>
STEP 2. Add the following code into the entry/post div (”index.php“, “archive.php“)
<?php the_content_limit(200, "Read more →") ?>instead of
<?php the_content(); ?>You can write whatever you want insted of “200″ and “Read more →”. Eg. (120, “Want to know more about it?”).
Solution 3 - Excerpt length using the “Excerpt Plugin”
PROS: Easy to use.
CONS: A basic skill in WP and PHP is required.
Source: Download from guff.szub.net
Set the excerpt length using the Excerpt Reloaded plugin. Simple theme editing is required.
Parameters:
- excerpt_length (integer) - Number of words to display. Default is 120.
- allowedtags (string) - Defines HTML tags. Default is ‘<a>’.
- filter_type (string) - Defines how WP should filter the content. Options are based on tags: ‘content’, ‘content_rss’, ‘excerpt’, ‘excerpt_rss’. Set to ‘none’ to display raw content. Default is ‘excerpt’.
- use_more_link (boolean) - Display the “more” link (TRUE) or (FALSE). Defaults to TRUE.
- more_link_text (string) - Define the text used for the link. Default is ‘(more…)’.
- Other functions: force_more_link (boolean) - fakeit (integer) - fix_tags (boolean).
Happy coding! :)









No comments yet.