• Resolved swoolrich

    (@swoolrich)


    Working on an off-line setup with the latest version of WordPress and Twenty TwentyThree.

    I’m trying to rework this site to use Twenty Twenty-Three but cannot manage to get the text wrapping around the image as per the current site. It’s using the Hueman theme but I’ve not had problems wrapping text in a variety of pre-block themes.

    I’ve tried various combinations of groups, stacks, rows, and alignments but haven’t found the magic formula – I assume there is one!

    The page I need help with: [log in to see the link]

Viewing 14 replies - 1 through 14 (of 14 total)
  • Kavya Gokul

    (@properlypurple)

    Hi @swoolrich! You can add an ‘Inline image’ inside a paragraph block, and it will have your text wrap around the image automatically. This page about formatting options has more details about how to use this option.

    Thread Starter swoolrich

    (@swoolrich)

    I created a test page and looked at the ‘inline image’ option and found it’s not cutting the mustard in many ways.

    I’ve also tried the media & text block which is nearly there, except it displays as if the image was in a separate column to the text – with a long enough paragraph of text it doesn’t start wrapping below the image. The same is true with several shorter paragraphs.

    I wonder if any of the various block add-ons has the right one for me?

    Thread Starter swoolrich

    (@swoolrich)

    OK the answer is blindingly simple. Add the image, add the text paragraphs, then select the Alignment dropdown. As well as the usual options of None, Wide Width & Full Width, for an image it includes Left, Centre & Right alignments.

    There are some spacing issues in the page but this is the right starting place.

    Thread Starter swoolrich

    (@swoolrich)

    Ho hum that’s not the complete solution – it looked like it was on a narrow screen.

    On a bigger screen the image was right aligned, but it was aligned with the right-hand margin of the header, not the page contents. By default the header is ‘Wide Width’ (1200px), the contents ‘None’ e.g. a maximum of 650px.

    I tried wrapping the page contents in a stack of the correct width and the image in the stack no longer has an align option in it’s toolbar.

    So what is?

    Thread Starter swoolrich

    (@swoolrich)

    After further experiments I have found this is an issue in 2023, 2024 and Blocksy – but not in Spectra One. So that is what I’ll use.

    Moderator jordesign

    (@jordesign)

    Hey @swoolrich – the way themes handle aligned images (and float them with text wrapping around) is definitely going to vary – so I’m glad you found one that worked well for you 🙂

    Thread Starter swoolrich

    (@swoolrich)

    Not impressed that I can’t do it in the new standard themes as thee first response to any layout problem is to change to a standard theme!

    And floating text round an image is a pretty basic thing to want to do.

    Hey @swoolrich! I did some more testing on this, with the 2023 theme, and it looks like the theme basically makes left or right-aligned images break out of the content container, and forces them to stick to the edge of the screen. A solution to this, is to put your paragraphs and images inside a group block.

    I’ve set up a test page showing this(both default and how it behaves inside a group block). This page is on a temporary site, so I’m also putting screenshots below:

    Thread Starter swoolrich

    (@swoolrich)

    Thanks. I did get there in the end, and I have a suspicion that there was a problem in the site I was trying to alter, which was an existing site, which was upsetting the themes.

    This is an issue in TT2, TT3 and TT4 (as well as some other block themes).

    As the image block is not wrapped in a div, it is not treated as part of the content and floats outside of it.

    The following CSS fixes it:

    @media only screen and (min-width : 768px) {
    .single figure.alignleft {
    	margin-inline-start: calc( ( 100% - var(--wp--style--global--content-size)) / 2 ) !important;
    }
    
    .single figure.alignright {
    	margin-inline-end: calc( ( 100% - var(--wp--style--global--content-size)) / 2 ) !important;
    }
    }

    Basically it moves the margin into the content for figure elements (pullquotes and images). Wrapping it in .single limits this to posts, but if you want the same behaviour on pages just remove it.

    The media rule is to just do it on larger screens, it will wrap nicely on smaller screens anyway.

    Thread Starter swoolrich

    (@swoolrich)

    Thanks for that. What is bizarre is I created a new WordPress installation on a local PC, and amended the sample page.

    I put the first paragraph in a group, and added an image into the group above it, with right justification. And it works correctly!!!

    I’ve ended up wondering if there was some issue with the page from the older website I was trying to amend, and had I started from scratch it would have been OK.

    BTW how in the TT2023 theme would I add custom CSS?

    Moderator jordesign

    (@jordesign)

    BTW how in the TT2023 theme would I add custom CSS?

    In Block themes you can add CSS following these instructions:
    https://wordpress.org/documentation/article/styles-overview/#applying-custom-css

    Thread Starter swoolrich

    (@swoolrich)

    Thanks

    Thanks to this thread, I was finally able to do this. Since I was working within a columns block, I inserted the content into one of the columns to act as the container. In case someone wants to wrap text around an image, below are the steps I took.
    1. Insert an image into a container (group or columns block) and from the toolbar in the preview screen, select the desired alignment.
    2. Insert the paragraphs below or above the image, depending on the image alignment that was selected.
    3. Play around with the image width. Enter the width in the settings ribbon, instead of the dimensions ribbon. Alternatively, use custom CSS to target width using clamp().
    4. Margin between the image and text is set with the figure tag and not the img tag, so custom CSS is needed if you want to target that.

    Some things in WP are just no intuitively designed. Once I saw that Media & Text block wasn’t an actual text wrap, I figured it wasn’t possible to do without custom HTML and CSS. So, I spent hours within the last two days. The alignment options should be moved to the settings area and be prominently displayed right above or below the width and height row. Moreover, WP should consider providing a block called “wrap text” or “float image” that is similar to the Media & Text block but uses float. Also, it would be good if we could target the margin directly in the editor which I think would mean moving the margin setting to the img tag or allowing the figure tag to be edited.

Viewing 14 replies - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.