You appear to be a bot. Output may be restricted
Description
Expands shortcodes in the excerptOriginally entitles, 'Safely invoke the "get_the_excerpt" filter' The reason we apply filters here is to expand shortcodes. And we want to expand only those shortcodes that are allowed to expand in excerpts. There is no need to do this if there aren't any shortcodes. So we do a simple check for the starting character '[' Note: We don't want other filters to try doing things based on the global post, so we use bw_global_excerpt() to make it look as if there isn't an excerpt. And because we're expanding shortcodes that may use bw_echo() we need to make use of bw_push() and bw_pop().
Usage
bw_get_the_excerpt( $excerpt );
Parameters
- $excerpt
- ( mixed ) required –
Returns
voidSource
File name: oik/includes/bw_posts.phpLines:
1 to 18 of 18
function bw_get_the_excerpt( $excerpt ) { $doit = strpos( $excerpt, "[" ); bw_push(); if ( $doit !== false ) { $saved_excerpt = bw_global_excerpt( null ); //$excerpt = apply_filters( "get_the_excerpt", $excerpt ); $excerpt = do_shortcode( $excerpt ); // bw_trace2( $excerpt, "excerpt after", false ); bw_global_excerpt( $saved_excerpt ); } $excerpt = do_blocks( $excerpt ); bw_pop(); return( $excerpt ); }View on GitHub View on Trac