Site logo

Archived topic

Single Pages Space Off Because of [caption]

3 replies · Started by Carl on November 17, 2022

Viewing posts 1–4 of 4

Hi - I have a couple of old posts where the padding between the content and the sidebar gets removed. Doing some experimenting with removing content from the post, I believe that images wrapped in [caption][/caption] are causing the padding to collapse between the content and the sidebar. Any solution for this?

Hi Carl,

How are you specifically adding the images? The issue seems to be their width (790px). Try unsetting their width and see how it goes.

Hi - I don't remember how they were added, as it was the classic WordPress editor at the time. You mentioning the width made me do a search, however. It seems like the caption shortcode was using inline styling and breaking the layout. I found a code that solved the problem.

function my_img_caption_shortcode_width ($width, $atts, $content) {
  return 0;
}
add_filter( 'img_caption_shortcode_width', 'my_img_caption_shortcode_width', 10, 3 );

Hi there,

i only notice the issue in Chrome and if i consent to the adverts on that page, so i wonder if its the ad scripts on there thats causing an issue ?

One thing i did notice is the Sign Up to Become a premium member image in the sidebar has an .alignleft class, which is floating that image. It may not be related to the above, but it could affect any JS width calcs that are going on that the ad scripts may use.

This archived topic is closed to new replies.