WordPress: customize the excerpt
Posted on 31. May, 2010 by admin in Blog
With the following codes, you can remove the tags and trailing dots from excerpt. You can also specified how many characters you want the excerpt has before it is cut off.
function ipanda_excerpt($excerpt, $substr=0) {
$string = strip_tags(str_replace('[...]', '...', $excerpt));
if ($substr>0) {
$string = substr($string, 0, $substr);
}
return $string;
}
You can use the above function in the index, single, archive big loop.
<?php echo ipanda_excerpt($post->post_content, 800); ?>...(<a href="<?php the_permalink() ?>">read more..</a>)
You may change the number “800″ to whatever to suit your design.


