Image width increases when there are captions
-
Prior to blocksy, I did everything with the classic editor. After migrating everything over, it turns out that the photos with captions on it have a much wider width and seems to “stretch” past the content container, overlapping into the sidebar. On mobile, it is even worse as you can’t even see the whole picture.
If I look at the code editor for photos without captions, they look something like this
<a href="https://staging2.johnnyafrica.com/wp-content/uploads/2020/11/pa028989.jpg"><img class="aligncenter size-full wp-image-41974" src="https://staging2.johnnyafrica.com/wp-content/uploads/2020/11/pa028989.jpg" alt="Positano beautiful view italy amalfi coast" width="1024" height="768"></a>
With a caption, they look like this
[caption id="attachment_41909" align="aligncenter" width="1024"]<a href="https://staging2.johnnyafrica.com/wp-content/uploads/2020/11/pa018919.jpg"><img class="size-full wp-image-41909" src="https://staging2.johnnyafrica.com/wp-content/uploads/2020/11/pa018919.jpg" alt="Capri Villa Lysis" width="1024" height="768"></a> Villa Lysis in Capri[/caption]
If I remove the “width = “1024” from the caption code, it just removes the captions straight up (but the width of the photo is back to normal).
Similarly, if i convert everything to blocks, the new code for the phtoo with captions becomes this
<!-- wp:image {"align":"center","id":41909} --> <figure class="wp-block-image aligncenter"><a href="https://staging2.johnnyafrica.com/wp-content/uploads/2020/11/pa018919.jpg"><img src="https://staging2.johnnyafrica.com/wp-content/uploads/2020/11/pa018919.jpg" alt="Capri Villa Lysis" class="wp-image-41909"/></a><figcaption>Villa Lysis in Capri</figcaption></figure> <!-- /wp:image -->
This actually fixes the problem with the width but I really want to stay using the classic editor.
Is there a way to fix this holistically? I have like 500 posts and I don’t want to go through every post to manually fix this as there are so many photos.
The page I need help with: [log in to see the link]
- The topic ‘Image width increases when there are captions’ is closed to new replies.