The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 9 years ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.
I am trying to create a grid in the bootstrap 3 framework, but I need it to adapt the number of columns depending on the screensize: col-xs-12 col-sm-6 col-md-4 col-lg-3 (1, 2, 3 or 4 columns)
If I create the standard loop using four columns, the grid breaks when changing to three because the row only holds four and so the first line has three and the second line only shows one.
So finally I chose twelve, as it can be divided by 4, 3 and 2 :
But this only works if the pictures are exactly the same height.
Is there another way to get the loop done in order to get this correct, even with a deviation on the height of a picture?
Thanks.
Wim
I guess I found a bootstrap solution by adding a clearfix:
<div class="clearfix visible-sm-block"></div> after every two thumbnail columns
<div class="clearfix visible-md-block"></div> after every three thumbnail columns
<div class="clearfix visible-lg-block"></div> after every four thumbnail columns
Working example on hidden link
This should be the new loop, but I don't have a clue how to implement this in views:
When one of the dimensions is used for a picture (width or height), the other is proportionally works (adopted). One solution is to use fixed height/width (either px or %). You can also use max-width/height but only in case, if you are sure that your image's width/height is always bigger than the applied max-width/height. Because max-width/height will not force the image to stretch upto the fixed dimensions, but will limit if it exceeds (keeping both proportional).
However, a clearfix should do the trick also. The code you provided in your later message, is handling the every column. This is just like [wpv-item index=n] where you can specify the output for a particular column in a loop.
I hope this explains. However, if you can provide a URL to live example, that will be helpful, thanks.
Hello Waqas,
Thanks for the reply - I know a fixed height will solve it, but I'd like to avoid this as some pictures get more caption than others.
I've been trying to get my last loop in views, but I don't succeed in doing this.
Could you give me a hint how to put
in the [wpv-item index= ] ?
Or any other solution? Custom loops of this caliber are nowhere to be found in the forums or the views documentation.
Thanks a lot.
Gr
Wim
Hi Waqas,
I had already been there, but it seems silly to hardcode indexnumbers if you don't know how big the loop will be. It could be ten, but also a hundred or more.
I don't want to specify all indexes one by one, but I'd like to program it using some math. Is this possible?
Thanks
Wim
Unfortunately that's not possible within the scope of the short codes and solutions provided by the Views. However, you can write custom code (custom short codes) in your functions.php, to achieve such solutions.
You can also contact our Custom Coding Service (hidden link) to build such solutions for you.