Why don't shortcodes work when a post is view on Home page but they do when viewing single post. You can see the issue here.

There are suppose to be two element's above the image - generated by JW Player and a custom shortcode, and one shortcode below the image - generated by Lightbox Evolution plugin.

3 Answers 3


Is the homepage pulling in the_excerpt() ? If so you will have to add this to your functions.php

add_filter('the_excerpt', 'do_shortcode');

This will work if you are putting in manual excerpt. It shouldn't be stripping out the shortcode if you are using the_content() in your homepage template.

  • No, I used content not the_content nor the_excerpt. It's defined by this: function content($limit) { $content = explode(' ', get_the_content(), $limit); if (count($content)>=$limit) { array_pop($content); $content = implode(" ",$content).'...'; } else { $content = implode(" ",$content); } $content = preg_replace('/\[.+\]/','', $content); $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); return $content; } How do I modify your code and get it to work? I tried content in your code but it didn't work.
    – rlab
    Dec 16, 2011 at 19:57

Why not just add another metabox for introductory text? You can set that up easily with this plugin http://wordpress.org/extend/plugins/magic-fields-2/.

That way you can just use content and excerpt as they were intended...much less of a headache.

  • Because I use introductory text for FB and Twitter sharing. Two birds, one stone...
    – rlab
    Jan 25, 2012 at 13:23
  • You could also just add a homepage excerpt box and when you pull it into the template you could use the do_shortcode() function. Example: echo do_shortcode($customfieldcontent);
    – kramdraw85
    Jan 25, 2012 at 14:55

I think it's because of the function, you can use this plugin it can limit your excerpt, and you can also enable and disable the the shortcodes.

  • So you think there's no way around it if I use content? I use it because I use the_excerpt on my single post to display "introductory" text for a post.
    – rlab
    Dec 17, 2011 at 11:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.