[wp-hackers] Excerpt output

Nicholas Ciske nl at thoughtrefinery.com
Wed Jun 11 15:10:47 UTC 2014


A filter running at priority 100 is going to run after anything in core (which generally defaults to 10, but not always)... and anything added with the default priority (10).

Find where your theme or plugin adds do_shortcode to the_excerpt filter and hook in earlier (e.g. priority 5).

Keep in mind that strip_shortcodes removes all shortcodes and their content. You'll probably need a regex to strip out everything but the shortcode you want -- then let the do_shortcodes filter do it's job up the stack.

Related and possibly useful:

Stripping shortcodes, keeping the content
http://wordpress.org/support/topic/stripping-shortcodes-keeping-the-content

_________________________
Nick Ciske
http://thoughtrefinery.com/
@nciske	

On Jun 11, 2014, at 8:07 AM, Dino Termini <dino at duechiacchiere.it> wrote:

> Is there a way to tweak the_excerpt so that all but one shortcode are stripped from the output?
> 
> Example:
> 
> [vc_row][vc_column width="1/4" el_class="sidebar"]sidebar content here[/vc_column][vc_column width="3/4"][vc_column_text el_class="use-as-excerpt"]main content[/vc_column_text][/vc_column][/vc_row]
> 
> When the excerpt is displayed, it should return just what's inside the vc_column_text shortcode: main content.
> 
> When inspecting the content passed to the function by add_filter( 'the_excerpt', 'strip_shortcodes' ), 100 ) , I see the shortcodes have already been executed :/



More information about the wp-hackers mailing list