WordPress should really strip shortcodes for excerpt use, but that’s a discussion for another day.
Try adding this to your theme’s functions.php file:
add_filter( 'get_the_excerpt', 'do_shortcode', 5 );
Thread Starter
Justin
(@instantok)
Totally hear you. Thanks for the code snippet. I was able to create a similar effect using a custom field and some notes from another discussion on this topic here. I will try this out as well.
Hey Viper,
I’d like to remove the shortcode from excepts as well. I’ve added that filter to my functions.php file but no joy.
You can see my development site here: dev.popmag.com.au.
This is my functions.php file:
<?php
if ( function_exists('register_sidebar') )
register_sidebar(array('name'=>'Main Sidebar',
'before_widget' => '<li>',
'after_widget' => '</li>',
'before_title' => '<h2 class="widgettitle">',
'after_title' => '</h2>',
));
register_sidebar(array('name'=>'Comments Sidebar',
'before_widget' => '<li>',
'after_widget' => '</li>',
'before_title' => '<h2 class="widgettitle">',
'after_title' => '</h2>',
));
register_sidebar(array('name'=>'Footer Sidebar',
'before_widget' => '<li>',
'after_widget' => '</li>',
'before_title' => '<h2 class="widgettitle">',
'after_title' => '</h2>',
));
add_filter( 'get_the_excerpt', 'do_shortcode', 5 );
?>
-Drew
PS: I agree WordPress should remove short codes from the excerpt.
Viper, I found this page which was useful, but my PHP skills arn’t good enough to figure it out.
http://www.aaronrussell.co.uk/blog/improving-wordpress-the_excerpt/