Skip Navigation

[Resolved] Ability to check how many times has run.

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

This topic contains 1 reply, has 2 voices.

Last updated by Beda 6 years, 7 months ago.

Author
Posts
#877496

Tell us what you are trying to do?
I am trying to put conditional styling on specific posts displayed in a parametric search. The very first result in the first iteration of the loop, for instance. I would also like to put special styling on the following 3 results.

However, I can only see ways to target results *within* each loop instance.

Is there any way to set an iterator, so that I know which iteration through a loop I am looking at?

What is the link to your site?
baystatebanner.com/obits

#879002

You can either address all items in a loop, single items, dynamically populated items and page items.

1. Addressing all Items is easy:
just wrap all content in your HTML

2. Addressing Single items is possible by using the ShortCode wpv-item:
https://toolset.com/documentation/user-guides/views-shortcodes/#vf-154400

3. Dynamically populated items are basically the same as above but using an intelligent GRID:
https://toolset.com/documentation/user-guides/digging-into-view-outputs/
https://toolset.com/documentation/user-guides/digging-into-view-outputs/#vmeta-wpv-loop-parameters

4. Page Items are the single, paginated sets of data that a paginated View returns.
This means you can check on the current page displayed, for example, if this is the first or third page of a paginated loop:
https://toolset.com/documentation/user-guides/views-shortcodes/#vf-153244 (wpv-pager-current-page)