What you have to do is to paste this code into your functions.php file and let WordPress filters do the work for you.
function my_excerpts($content = false) {
// If is the home page, an archive, or search results
if(is_front_page() || is_archive() || is_search()) :
global $post;
$content = $post->post_excerpt;
// If an excerpt is set in the Optional Excerpt box
if($content) :
$content = apply_filters(‘the_excerpt’, $content);
// If no excerpt is set
else :
$content = $post->post_content;
$excerpt_length = 55;
$words = explode(‘ ‘, $content, $excerpt_length + 1);
if(count($words) > $excerpt_length) :
array_pop($words);
array_push($words, ‘…’);
$content = implode(‘ ‘, $words);
endif;
$content = ‘<p>’ . $content . ‘</p>’;
endif;
endif;
// Make sure to return the content
return $content;
}
add_filter(‘the_content’, ‘my_excerpts’);
Thanks to Justin Tadlock for this cool snippet!
Looking for WordPress hosting? Try WP Web Host. Prices starts at $5/month and you can try it for free!Replace full…
370 readersIn WordPress 2.9 there will be two new filters to adjust an excerpt (the_excerpt). Previously with the_excerpt cut off at a maximum of 55 words and add a [...]. These filters are in WordPress 2.9 expandable. To change the values, you write two functions in your theme functions.php: // Changing excerpt length function new_excerpt_length($length) { return 40; } add_filter('excerpt_length', 'new_excerpt_length'); //
344 readersDo you ever wished to be able to modify the excerpt length based on which category you are on, without modifying your theme files? If yes, I'm pretty sure you'll be happy with that recipe.Looking for WordPress hosting? Try WP Web Host. Prices starts at $5/month and you can try it for free!WordPress tip :
1948 readersWordPress 3.0 will allow you to create custom post types, so what about being able to list those custom types on your blog homepage? This very useful piece of code will show you how you can do it.Looking for WordPress hosting? Try WP Web Host. Prices starts at $5/month and you can try it for
303 readersThe manual Excerpt in WordPress. What, why, how, tips and plugins.: Demetris has a written a very nice, well illustrated and explained tutorial on the WordPress excerpt and how to manipulate it to take full advantage of it. WordPress excerpts, which are not excerpts, make a WordPress site easier to browse and its content easier
2830 readersIntroduced in WordPress 2.9, get_the_post_thumbnail() allow you to display a thumbnail in your posts. But what about displaying post thumbnails in RSS feeds? Just read this recipe to know how to do.Looking for WordPress hosting? Try WP Web Host. Prices starts at $5/month and you can try it for free!WordPress hack: Display post thumbnail in
212 readersJustin Tadlock has written a nice tutorial on how to show a password form field instead of the default text “There is no excerpt because this is a protected post“. ¶
779 readersHow to replace excerpts for password-protected posts in WordPress with a password form instead of the standard no excerpt message.
294 readersDo you have filters set in your email program, be it Gmail, Yahoo! Mail, Hotmail or even Outlook? Anyone who uses filters knows how their ability to improve productivity by getting basic things done easily. So, why not take the power of filters and integrate it with our very own WordPress? This is what Matt
365 readersHave you ever wanted to display the excerpt only if you write one? A simple couple lines of code can display the_excerpt any where you like.
59 readersArchive pages are usually paged according to your settings in options/reading. Sometimes you may want to offer a page with all posts for an archive (time, category, search result). You need: a separate address for the unpaged archive, a filter for the internal WordPress query and a link to your ‘all posts’ page. We put
4,593
Curious what others are searching for? Below are the most popular search terms over the last 30 days.

