Skip Navigation

[Resolved] Return number of item in results of a query

This support ticket is created 6 years, 8 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
- 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/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 6 years, 8 months ago.

Assisted by: Luo Yang.

Author
Posts
#905251

Simple question: Is there a way to return a number (serial) for each item returned as a result of a query? In the OUTPUT I'd like to use the number of the item in resulting items from a query.
If there are 10 results I'd like a snip of code to put in the output that gives the # of that item in the result based on the order the query. Example: Let's say I have 20 posts in a CFT called "tour-days" and I've queried them to result in 10 items and want to list them each individually. I'm displaying one result of the ten in 10 different places on a single page using a view using limit="1" and offset"x" (0 through 9). I want the Output to look like this: "Tour Day 1 - Wine Tasting in Napa Valley" (limit="1" offset="0"). In another part of the page I want "Tour Day 2 - The Golden Gate Bridge" (that one is limit="1" offset="2") Is there any way to generate displaying the "1" and "2" in the serialized list?
Is there any documentation that you are following? No
Is there a similar example that we can see? Shown above.
What is the link to your site? This conceptual. Might it use it for food tours on the restaurant review site: hidden link
Thanks

#905333

Hello,

There isn't such a built-in feature within Toolset plugin, you will need to setup the value of attribute "offset" manually, or you can setup a custom shortcode for it, see wordpress document:
https://codex.wordpress.org/Function_Reference/add_shortcode