Problem: I have a View that displays results in 4 different styles. I would like to repeat the pattern of style 1, style 2, style 3, and style 4 in the results. Another ticket discusses a solution for repeating 2 styles: @https://toolset.com/forums/topic/changing-row-colors-in-a-view/
How can I extend this solution to work with 4 styles in a repeating pattern?
Solution: Use wrap="4" to indicate you want to repeat the pattern every 4 items in the results, and use the wpv-item shortcode to define each iteration of the 4-item loop.
[wpv-layout-start] [wpv-items-found] <!-- wpv-loop-start --> <wpv-loop wrap="4" pad="true"> [wpv-item index=1] <div class="style-red">[wpv-post-body view_template="Loop item in Styled View"]</div> [wpv-item index=2] <div class="style-green">[wpv-post-body view_template="Loop item in Styled View"]</div> [wpv-item index=3] <div class="style-blue">[wpv-post-body view_template="Loop item in Styled View"]</div> [wpv-item index=4] <div class="style-yellow">[wpv-post-body view_template="Loop item in Styled View"]</div> </wpv-loop> <!-- wpv-loop-end --> [/wpv-items-found] [wpv-no-items-found] <strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong> [/wpv-no-items-found] [wpv-layout-end]
Relevant Documentation:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-item
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 2 replies, has 2 voices.
Last updated by 3 years, 8 months ago.
Assisted by: Christian Cox.