WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

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.

share|improve this answer
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. – rlesko Dec 16 '11 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.

share|improve this answer
Because I use introductory text for FB and Twitter sharing. Two birds, one stone... – rlesko Jan 25 '12 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 '12 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.

share|improve this answer
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. – rlesko Dec 17 '11 at 11:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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