WordPress 3.4 – Image align problem
-
After upgrading to 3.4 images with caption text are no longer aligned. If no caption is included alignment works.
How do I resolve this?
-
Yes thanks. It was indeed some custom captioning code inside my theme functions.php
No Problem 🙂
There is extra padding around the image now, causing my layout to break. Any idea how to remove this and still keep the captions?
There is extra padding around the image now, causing my layout to break. Any idea how to remove this and still keep the captions?
If you refer to the padding on image with captions, you can filter the ‘img_caption_shortcode’ to fix this up
Hi Arie,
Thanks for the note. Can you explain how to use ‘img_caption_shortcode’?
For example, this image used to have the same amount of white space on either side of the image. Now, due to Thesis + WordPress 3.4, there is more spacing and it doesn’t look centered anymore.
http://www.happinessplunge.com/2011/08/photo-friday-%E2%80%93-a-texans-map-of-the-united-states-%E2%80%93-austin-tx-usa/Thanks!
This is what WordPress 3.4 Codex Says…
Change the image caption shortcode format to [caption ...]<img /> caption text + html[/caption]; that way HTML tags in captions are better supported and the shortcode wouldn’t break when using the wrong quotes
I think, all Custom WordPress Themes and Frameworks needs an update to fully support support WP 3.4.
Gallardomark, there is a simple solution in the Thesis forums so check it out. As for the image padding, I found a simple solution that I shared there too. 🙂
@gallardomark You can either go with @happinessplunge or may be wait for Next Version of Thesis 1.8.5 to be released next week. To overcome this issue, check out my article here
I noticed the same problem, just now after I upgraded to WordPress 3.4. I don’t really have time to examine themes at the moment, so will have to deal with this later. It’s quite annoying to have an alignment problem like this after an upgrade.
This function was causing the problem in our theme.
/*
* Fix the extra 10 pixel width issue for image captions
*/
add_shortcode(‘wp_caption’, ‘fixed_img_caption_shortcode’);
add_shortcode(‘caption’, ‘fixed_img_caption_shortcode’);
function fixed_img_caption_shortcode($attr, $content = null) {
// Allow plugins/themes to override the default caption template.
$output = apply_filters(‘img_caption_shortcode’, ”, $attr, $content);
if ( $output != ” ) return $output;
extract(shortcode_atts(array(
‘id’=> ”,
‘align’ => ‘alignnone’,
‘width’ => ”,
‘caption’ => ”), $attr));
if ( 1 > (int) $width || empty($caption) )
return $content;
if ( $id ) $id = ‘id=”‘ . esc_attr($id) . ‘” ‘;
return ‘<div ‘ . $id . ‘class=”wp-caption ‘ . esc_attr($align)
. ‘” style=”width: ‘ . ((int) $width) . ‘px”>’
. do_shortcode( $content ) . ‘<p class=”wp-caption-text”>’
. $caption . ‘</p></div>’;
}switching over to the snippet by Justin Tadlock did the trick for me > http://justintadlock.com/archives/2011/07/01/captions-in-wordpress
Hi, I also had the same problem with my image captions not being aligned under the image or in the frame (the frame is lost) after the upgrade to 3.4. I use theme Twenty-Eleven, and I haven’t done anything except hit the update button. I know nothing about code, so I’m not sure what to do to fix this…
My old posts are fine, my new post is not: http://lexireidstudio.com/2012/06/17/shadow-boxes-and-three-dimensional-collages/
Any assistance would be greatly appreciated!!
The topic ‘WordPress 3.4 – Image align problem’ is closed to new replies.