Skip Navigation

[Resolved] Display wpv-for-each field in a bootstrap grid

This thread is resolved. Here is a description of the problem and solution.

Problem: I have a repeating custom field, and I would like to use wpv-for-each to loop over each field and display them in a bootstrap grid.

Solution: The wpv-for-each structure isn't designed to support conditionals, so it's not possible to include row wrappers like this. A View, on the other hand, provides options for building these bootstrap-style grids with automatic rows. In order to use a View like this, you must create a post type that holds your images. The new post type should be a child of the post "LOOKING TO THE OTHER SIDE OF THINGS", and each image should be a custom field in a separate post in the new post type. Then you can loop over all the child posts of the current post in your View, and include row-based wrapper containers.

Relevant Documentation: https://toolset.com/documentation/user-guides/digging-into-view-outputs/

This support ticket is created 6 years, 9 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 5 replies, has 2 voices.

Last updated by jefM 6 years, 6 months ago.

Assisted by: Christian Cox.

Author
Posts
#615344

I want to display every portfolio image in a bootstrap grid.
To load all images I use [wpv-for-each field="wpcf-portfolio-afbeelding"] of the Custom post type portfolios.
Now the images are placed inbetween a col-sm-3 div but it don't show ok cause there is no indication of rows. How can it be solved?
Link to the site hidden link

On the homepage, different portfolio groups are placed after each other under the slider

#615362

Hi, the wpv-for-each structure isn't designed to support conditionals, so it's not possible to include row wrappers like this. A View, on the other hand, provides options for building these bootstrap-style grids with automatic rows. In order to use a View like this, you must create a post type that holds your images. The new post type should be a child of the post "LOOKING TO THE OTHER SIDE OF THINGS", and each image should be a custom field in a separate post in the new post type. Then you can loop over all the child posts of the current post in your View, and include row-based wrapper containers.

We have some additional documentation that shows how this can be done in a View:
https://toolset.com/documentation/user-guides/digging-into-view-outputs/

Let me know if you have additional questions about how this could be set up.

#615566

Thanks for your approach. As you can see on the homepage (hidden link) the images connected to the porfolio are displayed in bootstrap columns. So this is solved I think but in the admin screen of the parent post there is an alert message I don't understand.
"Repeat fields may not be used in the child posts. Types will update all field values" (see screenshot). Can you explain?

Another question. When you click on an image the image is shown in a lightbox. With the first approach with the repeating fields you could go through the complete gallery. Now only the one you clicked is in the lightbox. How do I solve that?

#615578

Update. The issue with the alert message is in the meantime solved. I still need help with the gallery in lightbox.

#615741

I'm not exactly sure how this lightbox plugin works to generate slideshows. Their documentation seems to indicate that you must insert the images directly in the post for this feature to work:
hidden link
hidden link
However, it does not go into much technical detail. If there is another way to indicate in your generated markup that a group of images should be organized into an individual slideshow, then perhaps their support team can provide more information.

#883057

The images of this tcket are indexed by Google. Can the be deleted/removed? Now the are inbetween the search results (images) of our client's name which was not the intention.