Skip Navigation

[Resolved] How to center grid

This support ticket is created 6 years, 2 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 4 replies, has 2 voices.

Last updated by Beda 6 years, 1 month ago.

Assisted by: Beda.

Author
Posts
#1113237

I have a grid of records and I want the records centered in the layout. So if there is one it should be in the middle, if 2 across there should be equal space on either side. See here:
hidden link

They seem to be left justified. Also a problem when on phone.

Thanks

#1113547

I would not think this is even possible, because you cannot check if there is a fourth item like you need
https://toolset.com/documentation/user-guides/views-shortcodes/#vf-154400

You can output specific things for the last (empty) item but not for the last (existing) item at all, not to speak of addressing it as last item in an odd end or even end, which is what you would need here, because then you could alter the HTML of the last item from a col-6 to a col-4 with 4 offsets and address the pad-last with a col-4 as well, so you could middle the last item if it's an odd result.

You would need a new index value that allows addressing *last* (as in the existing last output), and choose whether to address the last output only if an odd end.
With the existing pad-last and pad combined with such above described attribute, you could then change the row of the last items altogether.

I will need to discuss this request with my colleagues first, then I can feedback here if we could add something like it.

#1113662

Thanks, what I want to accomplish is have equal distance (padding) on either side of the record grid, the records would still start to the left so if 3 the last one on second row would be on left but the space to the left side of group and right side would be same. Now it looks like the left side is shorter distance then right, I have tried all kinds of things....

Here is a group of 4

hidden link

Thanks

#1114841

These are the exact same grids, and there is no different margins, as the grid perfectly obeys HTML and Bootstrap rules.

As stated, it's not possible, I am querying with the developers if we could add some new iteration shortcodes that let you address the last, not the pad or pad-last, item.
Then you can easily target that and add whatever HTML or CSS required/wanted.
Currently, there is simply no way to get the last item in a loop (I honestly am surprised about this, I was sure there is a way to get the last item.)

I will update you here once I have some news.

#1115574

This is the request we filed:
https://toolset.com/feature-request/add-last-last-even-and-last-odd-index-attributes-to-the-wpv-item-shortcodes/

Please upvote it here:
https://toolset.com/feature-request > Add last (Plugin: Views)

For now, there is no resolution to this in the Toolset Plugins