Skip Navigation

[Closed] aligning content in conditional

This support ticket is created 4 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 3 replies, has 2 voices.

Last updated by Christian Cox 4 years, 5 months ago.

Assisted by: Christian Cox.

Author
Posts
#1782747

Tell us what you are trying to do? align images produced with a conditional statement in blocks
Is there any documentation that you are following? no

Is there a similar example that we can see?no

What is the link to your site?hidden link
there are 3 conditional blocks within a container. If a field exists, an image is shown (the social icons at the bottom of page); if all 3 exist they line up nicely but if only one or two exist they need to display text-align: center. I've tried aligning the containers inner content, the conditional blocks, etc., nothing seems to work. the conditionals seem to occupy a space even when the conditional field doesn't exist - so no content should be present. (here's an example where all 3 fields do exist and there are 3 images: hidden link)

#1783367

Hello, it sounds like you need to make each column of a 3-column grid conditional. Unfortunately in the Block Editor once you set the number of columns in a grid, that is static and cannot be managed by a conditional. I think the only way to set this up is to use some custom CSS that overrides the float and display settings for each item. For example, you could apply a custom CSS class tssupp-custom-centering to the container element, then override the styles for each figure element inside that container:

.tssupp-custom-centering {
  text-align:center;
}
.tssupp-custom-centering figure.wp-block-image.tb-image.tb-image-dynamic
{
  float: none;
  display: inline-block;
}
#1783369

thanks, i'll try this. I tried using a grid initially, but then just took them out of the grid. it seems like the conditional adds a block, even if the results of the conditional are empty. I tried floating the images but maybe my css wasn't working - i'll try yours. thank you!

#1784391

I'll stand by for your update

The topic ‘[Closed] aligning content in conditional’ is closed to new replies.