I've created my own theme based on a very lean template. My theme is not parsing the
[caption]...[/caption] markup to the correct html. It's just showing the text without any markup around it. Here are the relevant observations for my situation:
- When editing the post it shows
[caption]...[/caption]in "Text" mode, and a nice image with caption in "Visual" mode. (as expected)
- If I view the post (single) it just renders an
<img .../>tag and the caption text as plain text.
- If I view the post (single) in theme TwentyEleven it does render the caption text in a special tag
<p class="wp-caption-text">my caption</p>. This is what I'm after in my own theme.
That last observation seems important, and should be my lead to the solution. I've dug through the TwentyEleven theme and found that it renders the content the same way as my own theme does:
<?php the_content(); ?>
I've opened and searched through all the TwentyEleven files, but could not find "wp-caption" anywhere important, or any other clue as to how TwentyEleven gets WordPress to parse the captions and render them with special markup.
I've gone through the functions.php file in TentyEleven because my instinct told me that's where the theme might register a hook or filter for parsing shortcode, but I couldn't find anything.
In addition, I've tried the following:
echo apply_filters('the_content', get_the_content());
But neither gives the desired result.
So, the question is: How does a theme get WordPress to parse captions and render them in special markup?