krimsly
Member
Posted 3 years ago #
Greetings all.
When I insert an image into a post and give it a caption, WordPress generates a shortcode that looks like this:
[caption id="attachment_55" align="alignleft" width="127" caption="Here is my caption"]<img class="size-full wp-image-55 " title="my image title" src="my-url/my-image.jpg" alt="my caption text" width="127" height="163" />[/caption]
Unfortunately, WordPress is not parsing the shortcode into HTML so the shortcode gets stuck as-is in the HTML. I'm not using any plug-ins so I don't think it is a plug-in incompatibility.
Does anyone have any ideas on this?
Thanks,
NorthK
Can you post a link to a page demonstrating this?
krimsly,
Show the code used to generate the caption beforehand.
krimsly
Member
Posted 3 years ago #
Hello all. Thanks for reading. It turns out the problem is because some WP functions call apply_filters() and some do not. The functions I was using in my theme (for example get_the_content()) did not so the short codes were not getting parsed. I needed to add this:
$content = get_the_content();
$content = apply_filters('the_content', $content);
However, that begs the question, what will happen to my theme in the future if the WP core adds the apply_filters() call to one of the functions I'm using-- there would be duplicate calls to apply_filter(). Please see my new post on this below for more info...
Thanks
NorthK
http://wordpress.org/support/topic/320635?replies=1#post-1245050
krimsly
Member
Posted 3 years ago #
methodagile
Member
Posted 3 years ago #
I'm getting the same problem, but only on post pages not listings. Go here for an example: http://www.bearingsguide.com/20091113/flasks/