Skip Navigation

[Resolved] Construct a view

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

Problem: I would like to set up a View that includes 9 items per row. The first item should span two rows of 4 smaller grid items. How should I set up the loop to support this structure?

Solution: Use the wrap, item and index attributes to set this up.

[wpv-layout-start]
    [wpv-items-found]
<section id="front-section-two" class="front-section cf">
    <!-- wpv-loop-start -->
    <wpv-loop wrap="9" pad="true">
        [wpv-item index=1]
        <div class="section-two-column-one">
<article>Content template here</article>
</div>
<div class="section-two-column-two columns-wrap">
        [wpv-item index=other]
            <article>Content template here</article>
        [wpv-item index=9]
            <article>Content template here</article>
        </div>
        [wpv-item index=pad]
             
        [wpv-item index=pad-last]
        </div>
    </wpv-loop>
    <!-- wpv-loop-end -->
</section>
    [/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/user-guides/digging-into-view-outputs/#vmeta-wpv-loop-parameters

This support ticket is created 5 years, 3 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)

Tagged: 

This topic contains 4 replies, has 2 voices.

Last updated by jesperK 5 years, 3 months ago.

Assisted by: Christian Cox.

Author
Posts
#1371427
Skærmbillede 2019-10-28 14.56.00.png

Tell us what you are trying to do?
Construct a view with one big post and the rest small

Is there any documentation that you are following?
https://toolset.com/documentation/user-guides/digging-into-view-outputs/

Is there a similar example that we can see?
See at attecthment

Can it be done in one view as a loop?
I am using a stock theme:
hidden link
They have made a custom grid system with columns like this:
[code]
<section id="front-section-two" class="front-section cf">
<div class="section-two-column-one">
<article></article>
</div>
<div class="section-two-column-two columns-wrap">
<article></article>
<article></article>
<article></article>
<article></article>
<article></article>
<article></article>
<article></article>
<article></article>
</div>
</section>

#1371489

Hi, I am not sure from your description, what repeats after 9 posts? Can you show me another mockup with 18 total posts?

#1371539

Hi Christian
One block would have 9 articles – one big and eight small. Just like in the screenshot.

The block has one section. Within this section there are two divs 'section-two-column-one' and 'section-two-column-two columns-wrap'.

The first 'section-two-column-one' div show one big article

The second 'section-two-column-two columns-wrap' show the eight small articles.

To show 18 articles as a mock-up would be to repeat the screenshot twice.

#1371553

Okay that makes sense, thanks. I wasn't sure if the large image was part of the block, or a one-off for the entire View. Here's how I would set it up, in general. Note that wrap="9" is required, since each block contains 9 elements. Also note that index=9 and "pad-last" contain the closing div tag that is started in index=1, and the closing section tag is after the end of the loop but still inside the wpv-items-found shortcode:

[wpv-layout-start]
	[wpv-items-found]
<section id="front-section-two" class="front-section cf">
	<!-- wpv-loop-start -->
	<wpv-loop wrap="9" pad="true">
		[wpv-item index=1]
		<div class="section-two-column-one">
<article>Content template here</article>
</div>
<div class="section-two-column-two columns-wrap">
		[wpv-item index=other]
			<article>Content template here</article>
		[wpv-item index=9]
			<article>Content template here</article>
		</div>
		[wpv-item index=pad]
			
		[wpv-item index=pad-last]
		</div>
	</wpv-loop>
	<!-- wpv-loop-end -->
</section>
	[/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]

In theory the Content Template could hold the article tags, just wanted to make it clear here in the setup.
https://toolset.com/documentation/user-guides/digging-into-view-outputs/#vmeta-wpv-loop-parameters

#1372283

My issue is resolved now. Thank you!