Using the WordPress default theme 2010 1.1, shortcodes work on the main blog page and individual post pages, but are being stripped out on category and archive pages.
For example, stick in the theme’s functions.php:
add_shortcode('tsc', 'tsc_process_shortcode' );
function tsc_process_shortcode($atts, $content = null) {
return 'INSERTED TEXT ' . $content;
}
INSERTED TEXT isn’t generated from [tsc] in post content shown on category and archive pages. How do I get shortcodes to function on category and archive pages?
Shortcodes are stripped from the excerpt before filters are applied. Try something more like this:
That basically re-runs
wp_trim_excerpt()
on the content (minus shortcode stripping) if it was trimmed to begin with. If you want to target your shortcode only, you could do something like this afterget_the_content('')
:Hope that helps.
Assuming that you are using the default 2010 the archive and category loops use
the_excerpt instead of the_content and that is why the shortcodes are not being generated, fortunately there is a simple fix for that , just add this line to your themes functions.php file
Hope this helps.