This plugin breaks WordPress (blank browser window) if a post has no excerpt. Any idea why?
<?php /*
Plugin Name: Excerpt in Post
Plugin URI: https://github.com/lukejanicke/excerpt-in-post
Description: Add post excerpts to top of post content output (inc. RSS) wrapped in <code><p class="excerpt">…</p></code>.
Version: 1.0
Author: Luke Janicke
Author URI: http://www.lukejanicke.com/
Licence: GPL2+
*/
function excerpt_in_post( $content ) {
// Add the excerpt to the top of posts (including in RSS feeds)
$excerpt = get_the_excerpt();
if ( $excerpt ) $content = sprintf( '<p class="excerpt">%s</p>%s', $excerpt, $content );
return $content;
}
add_filter( "the_content", "excerpt_in_post", 20 );
add_filter( "the_content_feed", "excerpt_in_post", 20 );
?>