Home » Web

Change WordPress’s excerpt length

By: Zhiqiang Ma On: Jan 26, 2010 Views: 37 No Comment Print Email
Tags: , , , ,

The default excerpt length of WordPress is 55 words. Some one like me may want to change the excerpt length.

I like the have a smaller excerpt length for the homepage. WordPress provides a interface for changing the default excerpt length. The method is very simple and easy.

Put these codes into the function.php file in the theme directory. I prefer 35 in my blog. It can be changed to any number you like. Or this value can be stored in the options table.

The code:


// excerpt length
function option_excerpt_length($text){
  return 35;
}

add_filter('excerpt_length', 'option_excerpt_length');

Read more:

Digg del.icio.us Stumble Techorati Facebook Newsvine Reddit Twitter
Mixx LinkedIn Google Bookmark Yahoo Bookmark MySpace LiveJournal Blogger RSS feed
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.