[wp-hackers] Post excerpts within the_content filter callback functions

rovo89 lists at robv.de
Wed Jun 16 17:14:02 UTC 2010


Am 16.06.2010 07:23, schrieb John Blackbourn:
> http://pastebin.com/xgnZfAEi
>
> The plugin outputs the excerpt above the post content, but in the
> process kills any shortcodes for any plugins you have installed,
> including the [testy] shortcode included in the plugin. If you remove
> the 'the_content' filter, shortcodes work fine.

Try this:

function content( $content ) {
     global $wp_current_filter;
     if ( !in_array( 'get_the_excerpt', $wp_current_filter ) ) {
         $excerpt = get_the_excerpt();
         $content = '<div style="border:1px solid red">' . $excerpt . 
'</div>' . $content;
     }
     return $content;
}


More information about the wp-hackers mailing list