Skip Navigation

[Resolved] Template in view for first item

This support ticket is created 3 years, 1 month 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 2 replies, has 2 voices.

Last updated by David Gimenez 3 years, 1 month ago.

Assisted by: Waqar.

Author
Posts
#2198379

Hello.

I want to get diferent template for the view in a loop like this

[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
	<wpv-loop wrap="1" pad="true">
		[wpv-item index=1]
		<div class="row ">
			<div class="col-md-12">FIRST</div>
		</div>
		[wpv-item index=other]
			<div class="col-md-12">OTHER</div>
		[wpv-item index=pad]
			<div class="col-md-12"></div>
		[wpv-item index=pad-last]
			<div class="col-md-12"></div>
		</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]

I think this is right but always shows FIRST in the loop. How can I get different content for the other items items?

Thanks!

#2198633

Hi,

Thank you for contacting us and I'd be happy to assist.

When wrap="1" is used, it sets the index counter to '1', for every result in the loop.

The correct usage, in this case, would be:


[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
	<wpv-loop>
		[wpv-item index=1]
		<div class="row ">
			<div class="col-md-12">
				First
			</div>
		</div>
		[wpv-item index=other]
		<div class="row ">
			<div class="col-md-12">
				Other
			</div>
		</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]

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#2202805

My issue is resolved now. Thank you!