Skip Navigation

[Resolved] How to add a running number in Views for RFGs?

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

Problem:

I want to add a running number in my Views for each row in my RFG.

Solution:

You can try shortcode [wpv-loop-index].

Relevant Documentation:

https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-loop-index

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

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 2 replies, has 2 voices.

Last updated by StanleyT8485 2 years, 7 months ago.

Assisted by: Luo Yang.

Author
Posts
#2131909

Tell us what you are trying to do?

I want to add a running number in my Views for each row in my RFG. For example, if I have 10 rows in the RFG, each row would have a number 1 to 10. Row 1 = 1, Row 2 = 2, Row 3 = 3, Row 9 = 9, etc.

One idea that I came up with is to use [wpv-item index=1] and do it for each row but that wouldn't be efficient.

<wpv-loop>
[wpv-item index=1]
<tr>
<td>1. [types field="career-quiz-question"][/types]</td>
<td><input name="q1" type="radio" /></td>
<td><input name="q1" type="radio" /></td>
<td><input name="q1" type="radio" /></td>
</tr>
[wpv-item index=2]
<tr>
<td>2. [types field="career-quiz-question"][/types]</td>
<td><input name="q2" type="radio" /></td>
<td><input name="q2" type="radio" /></td>
<td><input name="q2" type="radio" /></td>
</tr>
[wpv-item index=3]
<tr>
<td>3 [types field="career-quiz-question"][/types]</td>
<td><input name="q3" type="radio" /></td>
<td><input name="q3" type="radio" /></td>
<td><input name="q3" type="radio" /></td>
</tr>
</wpv-loop>

Is there a more efficient way to handle this?

#2132209

Hello,

You can try shortcode [wpv-loop-index], see our document:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-loop-index
This shortcode is used to display the current index in a View loop.

#2132323

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.