Skip Navigation

[Resolved] Ad in loop only one time

This support ticket is created 5 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.

Our next available supporter will start replying to tickets in about 0.45 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 1 reply, has 2 voices.

Last updated by Nigel 5 years, 1 month ago.

Assisted by: Nigel.

Author
Posts
#1372275

Hi,
We want to have just one Ad after 3rd item in Loop. We've tried with loop index 1/2/other and pad but we can not find a solution. We want the Ad just one time and not after 3 result, Just after the 3rd element.

Thanks so much and have a nice day!

#1372343

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

This will work if the output format of your View is a simple list:

	<!-- wpv-loop-start -->
	<wpv-loop>
      [wpv-item index=3]
		[wpv-post-body view_template="loop-item-in-list-things"]
      	<p>SOME AD GOES HERE</p>
      [wpv-item index=other]
		[wpv-post-body view_template="loop-item-in-list-things"]
	</wpv-loop>
	<!-- wpv-loop-end -->

Note that the wrap attribute is not included on the wpv-loop tag.

More complex View output formats, such as grids, require the wrap attribute and the pad entries, but in that case the index number is treated as "nth" instead of "n".

So in my example above, the section with index=3 is only output once, for the 3rd iteration of the loop.

If the wrap attribute were included on the wpv-loop tag then it would be output every 3rd iteration.